Search code examples
javascriptflashfirefoxyoutubebandwidth

How to automatically exit browser after youtube video has finished playing


Is it possible to exit the browser ( firefox) automatically after a video has finished playing ? Through some extensions / scripts ?

I need this because I want to automate measuring of bandwidth used while a youtube video played in firefox.


Solution

  • Here is the javascript API of youtube:

    https://developers.google.com/youtube/js_api_reference

    player.getPlayerState():Number
        Returns the state of the player. Possible values are unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
    

    You can handle it by javascript and close page after finished.