61 lines
1.7 KiB
Lua
61 lines
1.7 KiB
Lua
|
obs = obslua
|
||
|
|
||
|
youtube_server = "rtmp://a.rtmp.youtube.com/live2"
|
||
|
youtube_key = "VOTRE_CLE_YOUTUBE"
|
||
|
twitch_server = "rtmp://live.twitch.tv/app"
|
||
|
twitch_key = "VOTRE_CLE_TWITCH"
|
||
|
|
||
|
youtube_output = nil
|
||
|
twitch_output = nil
|
||
|
|
||
|
function script_description()
|
||
|
return "Script pour lancer des streams simultanés sur YouTube et Twitch."
|
||
|
end
|
||
|
|
||
|
function script_properties()
|
||
|
local props = obs.obs_properties_create()
|
||
|
|
||
|
obs.obs_properties_add_button(props, "start_both", "Lancer YouTube et Twitch", start_both_streams)
|
||
|
obs.obs_properties_add_button(props, "stop_both", "Arrêter YouTube et Twitch", stop_both_streams)
|
||
|
|
||
|
return props
|
||
|
end
|
||
|
|
||
|
function start_both_streams(props, p)
|
||
|
start_stream(youtube_server, youtube_key, "YouTube")
|
||
|
start_stream(twitch_server, twitch_key, "Twitch")
|
||
|
end
|
||
|
|
||
|
function stop_both_streams(props, p)
|
||
|
stop_stream(youtube_output)
|
||
|
stop_stream(twitch_output)
|
||
|
end
|
||
|
|
||
|
function start_stream(server, key, name)
|
||
|
local settings = obs.obs_data_create()
|
||
|
obs.obs_data_set_string(settings, "server", server)
|
||
|
obs.obs_data_set_string(settings, "key", key)
|
||
|
|
||
|
local service = obs.obs_service_create("rtmp_common", "service", settings, nil)
|
||
|
local output = obs.obs_output_create("rtmp_output", name, nil, nil)
|
||
|
obs.obs_output_set_service(output, service)
|
||
|
|
||
|
obs.obs_output_start(output)
|
||
|
|
||
|
if name == "YouTube" then
|
||
|
youtube_output = output
|
||
|
elseif name == "Twitch" then
|
||
|
twitch_output = output
|
||
|
end
|
||
|
|
||
|
obs.obs_data_release(settings)
|
||
|
obs.obs_service_release(service)
|
||
|
end
|
||
|
|
||
|
function stop_stream(output)
|
||
|
if output and obs.obs_output_active(output) then
|
||
|
obs.obs_output_stop(output)
|
||
|
obs.obs_output_release(output)
|
||
|
end
|
||
|
end
|