Difference between revisions of "Check engine version/en"

From Ace Stream Wiki
Jump to: navigation, search
(Проверка версии движка с помощью javascript API)
(Check engine version using javascript API)
 
Line 3: Line 3:
 
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.
 
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 checke engine version on a web page using javascript API.
+
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.
 
Method Player.getEngineVersion() is used for checking. It returns a string with engine version.
  
Узнать версию движка можно только после того, как на веб-страницу загрузился плагин Ace Stream P2P multimedia plugin. После завершения загрузки вызывается событие onLoad - именно в обработчике этого события нужно проверять версию.
+
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:
 
  <tt><nowiki><script type="text/javascript">
 
  <tt><nowiki><script type="text/javascript">
 
     var controls = new TorrentStream.Controls("player-div-id", {
 
     var controls = new TorrentStream.Controls("player-div-id", {
Line 32: Line 32:
 
  </script></nowiki></tt>
 
  </script></nowiki></tt>
  
В данном примере вместо комментария <tt>check engine version here</tt> вы можете реализовать свою проверку версии.
+
In this example instead of a comment <tt>check engine version here</tt> you can implement your version of checking.
  
Рабочий пример проверки версии можно посмотреть здесь: http://www.acestream.org/test/alpha.php. На данной странице запущена трансляция из-под движка версии 2.2.0 и стоит проверка на версию 2.2.х либо 3.х.х.
+
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.х.х.

Latest revision as of 16:27, 22 September 2014

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.х.х.