Check engine version/en

Материал из Ace Stream
(Различия между версиями)
Перейти к: навигация, поиск
(Проверка версии движка с помощью javascript API)
(Check engine version using javascript API)
 
Строка 3: Строка 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", {
Строка 32: Строка 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.х.х.

Текущая версия на 14:27, 22 сентября 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.х.х.

Персональные инструменты
На других языках