Start here for an overview of how to start developing a Roku channel:
http://forums.roku.com/viewtopic.php?f=34&t=36014The latest Roku SDK examples are located on SourceForge:
http://sourceforge.net/p/rokusdkexamples/code/HEAD/tree/trunk/rokusdkexamples-code/You can modify the simplevideoplayer channel to play an m3u8 video.
One approach is to start with something small and simple that just plays a single m3u8 file (assuming the content is in a format supported by Roku) using the roVideoScreen component. Then start adding other components once you get that working (an roSpringboardScreen, for example).
Here's a simple example that just plays an m3u8 HLS video using roVideoScreen, including logging all the events generated. This would be a good way to test whether your videos will play on the Roku:
Sub Main ()
displayM3U8 ({
Streams: [{
Url: "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"
Bitrate: 0
Quality: False
}]
StreamFormat: "hls"
})
End Sub
Function displayM3U8 (contentItem As Object) As Void
ui = CreateObject ("roVideoScreen")
mp = CreateObject ("roMessagePort")
ui.SetMessagePort (mp)
ui.SetContent (contentItem)
ui.Show ()
While True
msg = Wait (0, mp)
logEvent (msg)
If Type (msg) = "roVideoScreenEvent"
If msg.IsScreenClosed ()
Exit While
EndIf
EndIf
End While
End Function
Function logEvent (msg As Object) As Void
message = ""
index = 0
info = Invalid
If msg = Invalid
Print timeNow (); " Timeout"
Else
msgType = Type (msg)
If msgType = "roVideoScreenEvent" Or msgType = "roVideoPlayerEvent"
If msg.IsStreamStarted ()
evType = "IsStreamStarted"
index = msg.GetIndex ()
info = msg.GetInfo ()
Else If msg.IsPlaybackPosition ()
evType = "IsPlaybackPosition"
index = msg.GetIndex ()
Else If msg.IsRequestFailed ()
evType = "IsRequestFailed"
message = msg.GetMessage ()
index = msg.GetIndex ()
info = msg.GetInfo ()
Else If msg.IsStatusMessage ()
evType = "IsStatusMessage"
message = msg.GetMessage ()
Else If msg.IsFullResult ()
evType = "IsFullResult"
Else If msg.IsPartialResult ()
evType = "IsPartialResult"
Else If msg.IsPaused ()
evType = "IsPaused"
Else If msg.IsResumed ()
evType = "IsResumed"
Else If msg.IsScreenClosed ()
evType = "IsScreenClosed"
Else If msg.IsStreamSegmentInfo ()
evType = "IsStreamSegmentInfo"
message = msg.GetMessage ()
index = msg.GetIndex ()
info = msg.GetInfo ()
Else If msg.IsDownloadSegmentInfo () ' Undocumented event
evType = "IsDownloadSegmentInfo"
message = msg.GetMessage ()
index = msg.GetIndex ()
info = msg.GetInfo ()
Else If msg.IsListItemSelected () ' Undocumented event
evType = "IsListItemSelected"
index = msg.GetIndex ()
Else
evType = "Unknown"
EndIf
timeNowStr = timeNow ()
tabs = Len (timeNowStr) + Len (msgType) + 4
Print timeNowStr; " "; msgType; ". Event Type: "; evType + " [" + msg.GetType ().ToStr () + "]. "; "Index: " + index.ToStr ();
If message <> ""
Print ". Message: "; message
Else
Print ""
EndIf
If Type (info) = "roAssociativeArray"
For Each key In info
infoKey = info [key]
If Type (GetInterface (infoKey, "ifIntOps")) = "ifIntOps"
Print Tab (tabs); key + ": " + infoKey.ToStr ()
Else
Print Tab (tabs); key + ": "; infoKey
EndIf
End For
EndIf
Else
' An event type other than "roVideoScreenEvent" or "roVideoPlayerEvent"
' Add additional code here to handle other event types
Print timeNow (); " "; msgType; ". Event Type: [" + msg.GetType ().ToStr () + "]"
Endif
EndIf
End Function
Function timeNow () As String
dt = CreateObject ("roDateTime")
dt.ToLocalTime ()
hh = Right ("0" + dt.GetHours ().ToStr (), 2)
mm = Right ("0" + dt.GetMinutes ().ToStr (), 2)
ss = Right ("0" + dt.GetSeconds ().ToStr (), 2)
mmm = Right ("00" + dt.GetMilliseconds ().ToStr (), 3)
Return hh + ":" + mm + ":" + ss + "." + mmm
End Function