http live streaming - Unspecified or invalid track path/url - Roku with Livestream.com stream -


i'm developing custom roku channel , need use livestream.com video stream following live stream event:

http://livestream.com/accounts/11222132/events/3665575

using json service i've been able obtain m3u8 stream. stream works fine on ios, android, , fire os can't work on roku.

this code gets , attempts play stream:

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 , srt <> ""         videoclip.subtitleurl = srt     end if        video.setcontent(videoclip)     video.show()      lastsavedpos   = 0     statusinterval = 10 'position must change more number of seconds before saving      while true         msg = wait(0, video.getmessageport())         if type(msg) = "rovideoscreenevent"             if msg.isscreenclosed() 'screenclosed event                 print "closing video screen"                 exit while             else if msg.isplaybackposition()                 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 

in console following pertinent messages:

displaying video:

the json url is:

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@123585/*~hmac=dfacbbb090cc8df9435397d7c38d134be418756b3a00620297948eea35bedae7

srt =

unknown event: 11 msg: unspecified or invalid track path/url.

play failed:

closing video screen

the error i'm getting indicates url invalid , in fact if give url value of "nothing honey", gives me same error. if url getting json wrong.. how wrong? works on other devices...

from trail of internet breadcrumbs discovered answer following urls:

first guy had same problem did:

http://forums.roku.com/viewtopic.php?f=34&t=83773&p=494689&hilit=livestream.com#p494689

he says found solution here: http://forums.roku.com/viewtopic.php?f=34&t=66537&p=425668&hilit=akamai

the second link didn't have complete solution problem lacked few things i've added onto solution i'll post further down. if want put livestream.com live stream roku app need use api json object contains m3u8 stream. ordinarily send url video player , work needs 2 cookies doesn't automatically. in case have extract them , re attach them request.

'************************************************************* '** displaylivestream() '************************************************************* function displaylivestream ()     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    print theurl      req = createobject("rourltransfer")    req.setport(createobject("romessageport"))    req.seturl(theurl)       req.enablecookies()    req.enablefreshconnection(true)       if (req.asyncgettostring())       event = wait(30000, req.getport())       if type(event) = "rourlevent"          if (event.getresponsecode() <> 200)             'displaydialog("no live feed", "please check later.")             print "rourlevent"          endif           headers = event.getresponseheadersarray()       else if event = invalid           print "asyncgettostring timeout"           req.asynccancel()       else           print "asyncgettostring unknown event"       endif    endif      location = ""    each header in headers       print header       val = header.lookupci("set-cookie")       val2 = header.lookupci("location")       if (val <> invalid)          if (val.left(5) = "hdntl")             hdntl = val.left(instr(1,val,";")-1)          endif          if (val.left(6) = "_alid_")             alid = val.left(instr(1,val,";")-1)          endif       endif       if (val2 <> invalid)         location = val2       endif    end     port = createobject("romessageport")    screen = createobject("rovideoscreen")    screen.setmessageport(port)    screen.enablecookies()      print "hdntl is:"     print hdntl    print "alid is:" alid    screen.addheader("cookie",hdntl)    screen.addheader("cookie", alid)    stream = {       hdbranded: false       ishd: false       streambitrates: [0]       streamurls: [theurl]       streamqualities: [0]       streamformat: "hls"       live: true    }     screen.setcontent(stream)    screen.show()    lastsavedpos   = 0    statusinterval = 10 'position must change more number of seconds before saving      while true         msg = wait(0, screen.getmessageport())         if type(msg) = "rovideoscreenevent"             if msg.isscreenclosed() 'screenclosed event                 print "closing video screen"                 exit while             else if msg.isplaybackposition()                 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 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -