I want to handle video player Black screen which comes during buffering the video, I want to pause the video while it is about to start buffering, I trying but not able to do so Please help me out from this situation any kind of help would be helpful.
This question is required more detail. I think you try, when video state change to buffering then you try to paused video. correct?.
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?
No such method has been provided by Roku. But, you can make this possible in your way.
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 function
Using these codes you able to show loader instead of the black screen. I hope this is helpful to you.
Thanks for reply,
but this is not what we are searching for, Actually we want to show video frame should pause prior to buffering. and when we start video it will play next frame of video.