Script

Dc64

Member
Hi I am a student in software development and wanted to cerate a script to multi stream with obs but when I tried to run it the logs show it can't find ID or Youtube not found error. is this something that could work? does it makes any sense? any idea if not I just delete it thanks I posted the code because lua file not accepted

obs = obslua

function multistream_start_streaming(pressed)
if pressed then
-- Configuration
local stream_urls = {
twitch = "rtmp://live.twitch.tv/app/{stream_key}",
youtube = "rtmp://a.rtmp.youtube.com/live2/{}",
kick = "rtmp://kick.com/live/{}",
-- Add more platforms and their respective URLs here
}

-- Get the stream key from the OBS settings
local settings = obs.obs_data_create()
local stream_key = obs.obs_data_get_string(settings, "stream_key")
obs.obs_data_release(settings)

-- Start streaming to each platform
for platform, url_template in pairs(stream_urls) do
-- Replace the stream key in the URL template
local stream_url = string.gsub(url_template, "{stream_key}", stream_key)

-- Start streaming to the platform using OBS Lua API
obs.obs_frontend_streaming_start(stream_url)
end
end
end

function script_properties()
local props = obs.obs_properties_create()
obs.obs_properties_add_text(props, "stream_key", "Stream Key", obs.OBS_TEXT_DEFAULT)
return props
end

function script_defaults(settings)
obs.obs_data_set_default_string(settings, "stream_key", "")
end

function script_description()
return "Multistream Plugin"
end

function script_save(settings)
-- Not needed for this script
end

-- Register the multistream_start_streaming function as a script hotkey
obs.obs_hotkey_register_frontend("multistream_start_streaming", "Multistream Start", multistream_start_streaming)

-- Set the script description, properties, and default settings
obs.obs_register_script(script_description(), script_properties, script_save, script_defaults)
 
Top