我试图加入 igmp 直播并在 roku box 中播放。但它没有奏效。是不是我们不能在 Roku 盒子中加入多播流?如果可以通过 HLS 进行操作,那么解决方案是什么?我在 github 的链接中尝试了参考:https ://github.com/thetrime/trimeplay/blob/master/source/trimeplay.brs 请参考我用作参考的另一个代码:
function SetupJoin()
ssdpAddress = "239.60.60.7:6607"
ssdpPort = 6607
timeout = 300 * 60 * 1000
groupAddr = CreateObject("roSocketAddress")
groupAddr.setAddress(ssdpAddress)
groupAddr.setPort(ssdpPort)
listenAddr = CreateObject("roSocketAddress")
listenAddr.setPort(ssdpPort)
listenAddr.setAddress("0.0.0.0")
listen = CreateObject("roDatagramSocket")
listen.setReuseAddr(true)
listen.setAddress(listenAddr)
result = listen.joinGroup(groupAddr)
listen.setMessagePort(canvas.GetMessagePort())
listen.notifyReadable(true)
numResponses= Wait_SSDP(listen, timeout)
? "Result : " result
? "SSDP Listen got"; numResponses; " responses"
end function
function Wait_SSDP(socket as Object, timeout as Integer) as Integer
numResponses = 0
elapsed = CreateObject("roTimespan")
remaining = timeout - elapsed.totalMilliseconds()
while remaining > 0
msg = wait(remaining, socket.getMessagePort())
if type(msg)="roSocketEvent"
if socket.isReadable()
results = socket.receiveStr(255)
print "SSDP Listen gets from "; socket.getReceivedFromAddress().getAddress(); ":"
print results
numResponses = numResponses + 1
end if
else
exit while 'enter code here
end if
remaining = timeout - elapsed.totalMilliseconds()
end while
return numResponses
end function