Difference between revisions of "Check engine version/en"
(Новая страница: «==Проверка версии движка с помощью javascript API== Иногда возникает необходимость проверки верс…») |
(→Check engine version using javascript API) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | == | + | ==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: | |
<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> | ||
− | + | In this example instead of a comment <tt>check engine version here</tt> 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.х.х. |
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.х.х.