Forum Discussion
4 Replies
- chaklasiyanikunRoku Guru
This question is required more detail. I think you try, when video state change to buffering then you try to paused video. correct?.
- AbhiKStreaming Star
Actually, I want to display the video frame (of the point when video player started buffering) with a loader on it while video player is buffering, instead of showing a black screen in the background of a loader.
Is there any way to do so?- chaklasiyanikunRoku Guru
No such method has been provided by Roku. But, you can make this possible in your way.
Example :
I take a small example in a video player. Please, put the below code in an XML file.
<Video id="video_node_ID" height="720" width="1280" translation="[0,0]" visible="false" /> <LayoutGroup translation="[640,360]" horizAlignment="center" vertAlignment="center"> <BusySpinner id="spin" clockwise="true" spinInterval="2" /> </LayoutGroup>And Also, Put below code in your .brs file
sub init() m.video = m.top.findNode("video_node_ID") m.video.observeField("state", "stateChanged") m.spin = m.top.findNode("spin") m.spin.visible = false m.spin.uri = "pkg:/images/loader.png" end sub function stateChanged() ?"m.video.state : " m.video.state if m.video.state = "playing" ?"playback handling!" m.video.visible = true m.spin.control = "stop" m.spin.visible = false ?"playback handling Closed!" handled = true else if m.video.state = "buffering" ?"buffering handling!" m.video.visible = false m.spin.control = "start" m.spin.visible = true ?"buffering handling Closed!" handled = true end if return handled end functionUsing these codes you able to show loader instead of the black screen. I hope this is helpful to you.