and_cesbo icon

Astra. Rotate inputs

and_cesbo | PRO | 05/12/16 09:01:56 AM UTC | 0 ⭐ | 709 👁️ | Never ⏰ | []
Lua |

650 B

|

None

|

0 👍

/

0 👎

-- Change input every 10 minutes
 
s = make_channel({
    name = "CAM",
    input = {
        "rtsp://address-1",
        "rtsp://address-2",
    },
    output = {
        "udp://127.0.0.1:10000",
    },
    backup_type = "passive",
})
 
timer({
    interval = 10 * 60,
    callback = function()
        local input_id = s.active_input_id
        local next_input_id = input_id + 1
        if next_input_id > #s.input then next_input_id = 1 end
        channel_kill_input(s, input_id)
        log.info("[" .. s.config.name .. "] Destroy input #" .. input_id)
        collectgarbage()
        channel_init_input(s, next_input_id)
    end,
})

Comments