Check engine version/en

From Ace Stream Wiki
(Redirected from Check engine version)
Jump to: navigation, search

Check engine version using javascript API

Sometimes it is necessary to check a version of installed engine. For example, you have created a broadcast using a newer version of the engine, and this broadcast can't be viewed by users with older versions of the engine. In this case it is necessary to check the version and if needed to warn users with a message from a web page.

You can check engine version on a web page using javascript API.

Method Player.getEngineVersion() is used for checking. It returns a string with engine version.

You can find out engine version only after Ace Stream P2P multimedia plugin will be loaded on a web page. After loading is complete, onLoad event is triggered - in this event you need to check the version.

Example of a code to get engine version:

<script type="text/javascript">
    var controls = new TorrentStream.Controls("player-div-id", {
        style: "internal"
    });

    try {
        var player = new TorrentStream.Player(controls.getPluginContainer(), {
                useInternalControls: true,
                onLoad: function() {
                    var engineVersion = this.getEngineVersion();
                    // check engine version here
                    this.registerEventHandler(controls);
                    controls.attachPlayer(this);
                    this.loadPlayer(contentId);
                }
        });
    }
    catch(e) {
        controls.onSystemMessage(e);
    }
 </script>

In this example instead of a comment check engine version here you can implement your version of checking.

Working example of checking the version you can see here: http://www.acestream.org/test/alpha.php. On this page a broadcast was launched using engine version 2.2.0 and there is checking for versions 2.2.х or 3.х.х.