Forum Discussion

AbhiK's avatar
AbhiK
Streaming Star
6 years ago

Roku Video Player shows black screen while buffering the content

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.

Thanks

4 Replies

  • This question is required more detail. I think you try, when video state change to buffering then you try to paused video. correct?.

    • AbhiK's avatar
      AbhiK
      Streaming 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?

      • chaklasiyanikun's avatar
        chaklasiyanikun
        Roku 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 function

        Using these codes you able to show loader instead of the black screen. I hope this is helpful to you.