カスタム Roku チャンネルを開発しており、次のライブ ストリーム イベントから livestream.com ビデオ ストリームを使用する必要があります。
http://livestream.com/accounts/11222132/events/3665575
彼らの json サービスを使用して、m3u8 ストリームを取得できました。ストリームは iOS、Android、および Fire OS では問題なく動作しますが、Roku では動作しません。
このコードは、私のストリームを取得して再生しようとします:
Function displayVideo()
print "Displaying video: "
p = CreateObject("roMessagePort")
video = CreateObject("roVideoScreen")
video.setMessagePort(p)
'bitrates = [0] ' 0 = no dots, adaptive bitrate
'bitrates = [348] ' <500 Kbps = 1 dot
'bitrates = [664] ' <800 Kbps = 2 dots
'bitrates = [996] ' <1.1Mbps = 3 dots
'bitrates = [2048] ' >=1.1Mbps = 4 dots
bitrates = [0]
request = CreateObject("roUrlTransfer")
request.SetUrl("http://livestream.com/api/accounts/11222132/events/3665575/viewing_info")
jsonString = request.GetToString()
myJson = ParseJSON(jsonString)
theurl = myJson.streamInfo.m3u8_url
urls = [theurl]
print "the json url is:"
print urls
qualities = ["SD"]
StreamFormat = "hls"
title = "COACB TV 39"
srt=""
videoclip = CreateObject("roAssociativeArray")
videoclip.StreamBitrates = bitrates
videoclip.StreamUrls = urls
videoclip.StreamQualities = qualities
videoclip.StreamFormat = streamformat
videoclip.Title = title
print "srt = ";srt
if srt <> invalid and srt <> "" then
videoclip.SubtitleUrl = srt
end if
video.SetContent(videoclip)
video.show()
lastSavedPos = 0
statusInterval = 10 'position must change by more than this number of seconds before saving
while true
msg = wait(0, video.GetMessagePort())
if type(msg) = "roVideoScreenEvent"
if msg.isScreenClosed() then 'ScreenClosed event
print "Closing video screen"
exit while
else if msg.isPlaybackPosition() then
nowpos = msg.GetIndex()
if nowpos > 10000
end if
if nowpos > 0
if abs(nowpos - lastSavedPos) > statusInterval
lastSavedPos = nowpos
end if
end if
else if msg.isRequestFailed()
print "play failed: "; msg.GetMessage()
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
endif
end if
end while
End Function
私のコンソールでは、次の関連メッセージが表示されます。
ビデオの表示:
json の URL は次のとおりです。
http://api.new.livestream.com/accounts/11222132/events/3665575/broadcasts/92495453.m3u8?dw=100&hdnea=st=1436386598~exp=1436387498~acl=/i/11222132_3665575_bee34040_1@1235~hmac *85 =dfacbbb090cc8df9435397d7c38d134be418756b3a00620297948eea35bedae7
srt =
不明なイベント: 11 メッセージ: 未指定または無効なトラック パス/URL。
再生に失敗しました:
動画画面を閉じる
私が得ているエラーは、URLが無効であることを示しており、実際に「nothing Honey」のURL値を指定すると、同じエラーが発生します。したがって、このjsonから取得しているURLが間違っている場合..では、どのように間違っているのですか? それは私の他のデバイスで動作します...