Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
player1.Initialize("player")
Dim sources As List
sources.Initialize
sources.Add(player1.CreateDashSource("http://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&ipbits=0&expire=19000000000&signature=51AF5F39AB0CEC3E5497CD9C900EBFEAECCCB5C7.8506521BFC350652163895D4C26DEE124209AA9E&key=ik0"))
sources.Add(player1.CreateHLSSource("https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8"))
sources.Add(player1.CreateUriSource("http://html5demos.com/assets/dizzy.mp4"))
player1.Prepare(player1.CreateListSource(sources))
Dim jo As JavaObject = player1
Dim event As Object = jo.CreateEventFromUI("com.google.android.exoplayer2.ExoPlayer$EventListener", "statechanged", False)
jo.GetFieldJO("player").RunMethod("addListener", Array(event))
End If
Activity.LoadLayout("1")
SimpleExoPlayerView1.Player = player1
player1.Play
End Sub
Sub StateChanged_Event (MethodName As String, Args() As Object) As Object
If MethodName = "onPlayerStateChanged" Then
Dim Playing As Boolean = Args(0)
Log("IsPlaying: " & Playing)
End If
Return Null
End Sub