Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
kelvis2000
Visitor

Re: Video is fast on Web, slow on Roku? Url metadata below

I posted the code above the original in the appMain.brs.

When I open the channel the Splash screen opens for a few seconds a screen with a big empty box
or container where a video should be appears, pressing OK does nothing.
Press OK to start movie, Back to Exit. TimeTo Load: 0 seconds
Video Player is stopped.

So I don't see the overhang or all the icons I created
for the videos anymore, all that appears is the channel icon
which when pressed leads to the full screen Splash
which automatically after a few seconds goes to the screen
mentioned above?
Did I miss something here? I saw you had some code about initializing
which I did not include.
Thanks For Your Help,
Kevin
0 Kudos
NewManLiving
Visitor

Re: Video is fast on Web, slow on Roku? Url metadata below

Probably the best thing to do is to create another project in eclipse. Create a brs source file in the source directory and copy my code into it an export it. Close your project before running the new one. You would not see anything else because the main function or sub is the entry point into the application. As far as the box is concerned my main is all there is. When you press the back button does it exit, if so then you better wait for the loading to start, takes awhile. My guess is that the performance will be no different than what you have already. The time to load and messages on the bottom just display what is coming in on the message queue and a timer. So if nothing is coming in, or it is waiting then you will have to wait until something does. I just copied it from the post into my own main file and it works as indicated
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
NewManLiving
Visitor

Re: Video is fast on Web, slow on Roku? Url metadata below

Try this version, its a hack but it presents a better timer indicating that something is happening

Sub Main() 

hideL = -1
backL = 0
helloL = 1
videoL = 2
promptL = 3
messageL = 4

playerRect = { x: 50, y: 120, w: 630, h:452 }
punchRect = playerRect

back = { Color:"#FFFFFFFF", CompositionMode:"Source"}

hello ={
Text:"Press Ok To Start Movie, Back To Exit"
TextAttrs:{Color:"#FFCCCCCC", Font:"Medium",
HAlign:"HCenter", VAlign:"VCenter",
Direction:"LeftToRight"}
TargetRect:{x:100 + 630 + 10,y: 120 + 30,w:500,h:60}
}

prompt ={
Text: "TIME TO LOAD: " + " 0 " + "SECONDS "
TextAttrs:{Color:"#FFCCCCCC", Font:"Medium",
HAlign:"HCenter", VAlign:"VCenter",
Direction:"LeftToRight"}
TargetRect:{x:100 + 630 + 10,y: 120 + 30 + 60,w:500,h:60}
}

message ={
Text: "Video Player Is Stopped"
TextAttrs:{Color:"#FFCCCCCC", Font:"Medium",
HAlign:"HCenter", VAlign:"VCenter",
Direction:"LeftToRight"}
TargetRect:{x:0,y: 120 + 452 + 20,w:1280,h:60}
}


video = {
Color: "#00000000"
TargetRect: punchRect
CompositionMode: "Source" }

content = {

Stream: {
url: "http://guitar.objects.cdn.dream.io/VIDEOS/CCRyderB.m4v"
bitrate: 128
quality: True
contentId: "video"
}

StreamFormat: "mp4"
SwitchingStrategy: "full-adaptation"
}

timer = CreateObject( "roTimeSpan" )
canvas = CreateObject( "roImageCanvas" )
port = CreateObject( "roMessagePort" )
canvas.SetMessagePort(port)

VPlayer = CreateObject( "roVideoPlayer" )
VPlayer.SetMessagePort( port )
VPlayer.SetDestinationRect( playerRect )
VPlayer.AddContent( content )

canvas.SetLayer( backL , back )
canvas.SetLayer( videoL, video )
canvas.SetLayer( helloL, hello )
canvas.SetLayer( promptL, prompt )
canvas.SetLayer( messageL, message )
canvas.Show()

loading = False
seconds = timer.TotalSeconds()
while(true)

msg = port.GetMessage()

if loading
newSecond = timer.TotalSeconds()
if newSecond > seconds
seconds = newSecond
prompt.Text = "LOADING: " + seconds.ToStr() + " SECONDS"
canvas.SetLayer( promptL, prompt )
canvas.Show()
end if
end if

if type(msg) = "roImageCanvasEvent" then

if (msg.isRemoteKeyPressed()) then
i = msg.GetIndex()

if (i = 0) then
VPlayer.Stop()
canvas.close()
else if i = 6

VPlayer.Stop()

prompt.Text = "TIME TO LOAD: " + " 0 " + "SECONDS "
canvas.SetLayer( promptL, prompt )
canvas.Show()

sleep( 200 )
timer.Mark()
VPlayer.Play()
loading = True
seconds = timer.TotalSeconds()
end if

else if (msg.isScreenClosed()) then
print "Closed"
return
end if

else if type(msg) = "roVideoPlayerEvent" then

gmsg = msg.GetMessage()
print gmsg

message.Text = msg.GetIndex().ToStr() + " " + gmsg
canvas.SetLayer( messageL, message )
canvas.Show()

if gmsg = "startup progress"
loading = True
else if gmsg = "start of play"
prompt.Text = "TIME TO LOAD: " + timer.TotalSeconds().ToStr() + " SECONDS"
canvas.SetLayer( promptL, prompt )
canvas.Show()
loading = False
else
loading = False
end if

end if
end while

End Sub
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.