HbbTV-Association / Developer-Portal-Issues

A place to capture issues relating to the content and functionality of the HbbTV Developer Portal at https://developer.hbbtv.org/
0 stars 0 forks source link

4. Not explicitly stopping broadcast video before playing broadband #8

Open hiren3897 opened 1 year ago

hiren3897 commented 1 year ago

How to explicitly kill or stop the broadcast before starting the application

    try{
        var broadcast = $("#broadcast")[0];
        if( !broadcast ){
            $("body").append("<object type='video/broadcast' id='broadcast'></object>");
        }
        broadcast = $("#broadcast")[0];
        console.log( "Current broadcast.playState="+ broadcast.playState );
        if( broadcast.playState != 3 ) { // 0=unrealized, 1=connecting, 2=presenting, 3=stopped
            broadcast.stop();
            console.log("broadcast stopped");
                        appObject.show();
        }
    } catch(e){
        console.log("error stopping broadcast");
    }

Am I doing it the right way?

jpiesing commented 1 year ago

Others have more practical experience of this than me but ...

domagoj555 commented 1 year ago

There is a nice tutorial on how to handle the broadcast a/v object on the HbbTV developer site: https://developer.hbbtv.org/tutorials/handling-the-broadcast-av-object/