The rtmp stream is pushed to a server, i can't connect to it.
Cheers
local wsclients = {}
-- Write an integer in LSB order using width bytes.
function numbertobytes(num, width)
local function _n2b(width, num, rem)
rem = rem * 256
if width == 0 then return rem end
return rem, _n2b(width-1, math.modf(num/256))
end
return string.char(_n2b(width-1, math.modf(num/256)))
end
function onConnection(client)
if client.protocol == "WebSocket" then
NOTE("Added client websocket"); wsclients[client] = client.writer
end
function client:onPublish(publication)
function publication:onVideo(time,packet)
for c,w in pairs(wsclients) do
w:writeRaw("\x09"..time..packet)
end
end
function publication:onAudio(time,packet)
for c,w in pairs(wsclients) do
w:writeRaw("\x08"..time..packet)
end
end
end
end
function onDisconnection(client)
if wsclients[client] ~= nil then
wsclients[client] = nil
end
end
function onMessage(msg){
var reader = new FileReader();
reader.addEventListener("loadend", function() {
if (reader.result[0] == '\x09') {
console.log("video : "+reader.result.substr(1,17));
} else if (reader.result[0] == '\x08') {
console.log("audio : "+reader.result.substr(1,17));
}
});
reader.readAsBinaryString(msg.data);
}