multi-redirect handler
This commit is contained in:
parent
4c12b907d0
commit
cd77e170e6
@ -4,18 +4,34 @@ local autoload = require("lapis.util").autoload
|
|||||||
local function Authhandler(self)
|
local function Authhandler(self)
|
||||||
local name = self.params.name
|
local name = self.params.name
|
||||||
local password = self.params.password
|
local password = self.params.password
|
||||||
|
local yt_streamkey = self.params.youtube or nil
|
||||||
print(name)
|
|
||||||
print(password)
|
|
||||||
|
|
||||||
local endpoints = {
|
local endpoints = {
|
||||||
puik='something',
|
puik='something',
|
||||||
wstd='something',
|
wstd='something',
|
||||||
buzz='something'
|
buzz='something'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if endpoints[name] == password then
|
if endpoints[name] == password then
|
||||||
return {status = 201}
|
local urls = {}
|
||||||
|
|
||||||
|
local hls_url = "rtmp://127.0.0.1/streamhls/" .. name
|
||||||
|
table.insert(urls, hls_url)
|
||||||
|
|
||||||
|
if yt_streamkey then
|
||||||
|
local yt_url = "rtmp://127.0.0.1/youtube/" .. yt_streamkey
|
||||||
|
table.insert(urls, yt_url)
|
||||||
|
end
|
||||||
|
|
||||||
|
local redirect_urls = table.concat(urls, ",")
|
||||||
|
|
||||||
|
return {
|
||||||
|
"remote push", {
|
||||||
|
layout=false,
|
||||||
|
redirect_to=redirect_urls
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return {status = 404}
|
return {status = 404}
|
||||||
end
|
end
|
||||||
|
|||||||
@ -16,13 +16,23 @@ rtmp {
|
|||||||
live on;
|
live on;
|
||||||
|
|
||||||
on_publish http://localhost:${{PORT}}/auth;
|
on_publish http://localhost:${{PORT}}/auth;
|
||||||
|
}
|
||||||
|
|
||||||
|
application youtube {
|
||||||
|
live on;
|
||||||
|
|
||||||
|
exec ffmpeg -i rtmp://localhost:1935/youtube/$name -c:a copy -c:v copy -f flv rtmp://a.rtmp.youtube.com/live2/$name;
|
||||||
|
}
|
||||||
|
|
||||||
|
application streamhls {
|
||||||
|
live on;
|
||||||
|
|
||||||
#relays the incoming video to low quality streams on this server, audio-only version and to a different server
|
#relays the incoming video to low quality streams on this server, audio-only version and to a different server
|
||||||
exec ffmpeg -i rtmp://localhost:1935/stream/$name
|
exec ffmpeg -i rtmp://localhost:1935/streamhls/$name
|
||||||
-c:a copy -c:v copy -f flv rtmp://localhost/hls/$name_hi;
|
-c:a copy -c:v copy -f flv rtmp://localhost/hls/$name_hi;
|
||||||
exec ffmpeg -i rtmp://localhost:1935/stream/$name -max_muxing_queue_size 1024
|
exec ffmpeg -i rtmp://localhost:1935/streamhls/$name -max_muxing_queue_size 1024
|
||||||
-c:a copy -c:v libx264 -b:v 500K -preset superfast -profile:v baseline -f flv rtmp://localhost/hls/$name_low
|
-c:a copy -c:v libx264 -b:v 128K -preset superfast -profile:v baseline -f flv rtmp://localhost/hls/$name_low;
|
||||||
2>/mnt/radio/logs/ffmpeg-$name_low.log;
|
# 2>/mnt/radio/logs/ffmpeg-$name_low.log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +64,7 @@ http {
|
|||||||
server {
|
server {
|
||||||
listen ${{PORT}};
|
listen ${{PORT}};
|
||||||
lua_code_cache ${{CODE_CACHE}};
|
lua_code_cache ${{CODE_CACHE}};
|
||||||
|
|
||||||
# nginx-rtmp hls and status endpoints
|
# nginx-rtmp hls and status endpoints
|
||||||
location /hls {
|
location /hls {
|
||||||
types {
|
types {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user