Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on_publish redirect happens, but fails to create hls directory #1765

Open
sachin-danpheit opened this issue Jul 11, 2024 · 0 comments
Open

Comments

@sachin-danpheit
Copy link

Goal is to achieve the renaming of stream directory as in #1705

The 302 redirect happens to http://host.docker.internal/username and the nginx/hls tries to create a directory but with the full url and errors out.

Why nginx/rtmp is trying to create folder with the full url instead of just creating with the returned username only?
How do I fix this?

[error] 29#29: *4 hls: mkdir() failed on '/var/www/live/http://host.docker.internal/username' (2: No such file or directory), client: 127.0.0.1, server: 0.0.0.0:1935

My nginx config

rtmp {
    server {
        listen 1935;
        listen [::]:1935 ipv6only=on;
        
        application app {
            live on;

            # Don't allow RTMP playback
            deny play all;

            # Push the stream to the local HLS application
            push rtmp://127.0.0.1:1935/hls;

            # The on_publish callback will redirect the RTMP
            # stream to the streamer's username, rather than their secret stream key.
            on_publish http://host.docker.internal:8000/start_stream;
            on_publish_done http://host.docker.internal:8000/stop_stream;
        }

        application hls {
            live on;

            # Only accept publishing from localhost.
            # (the `app` RTMP ingest application)
            allow publish 127.0.0.1;
            # allow publish all;
            deny play all;

            # Package streams as HLS
            hls on;
            hls_path /var/www/live;
            hls_nested on;
            hls_fragment_naming system;
            hls_datetime system;
        }
    }
}

Originally posted by @sachin-danpheit in #1705 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant