Open main menu

Ace Stream Wiki β

Embedded Player/en

Revision as of 13:14, 24 December 2012 by Ankiria (talk | contribs) (Links required to embed the player to site's page)

Demo version

Links required to embed the player into site's page

To embed the player into site's page, insert scripts and styles before the closing tag </body>.

 <script type="text/javascript" src="http://static.torrentstream.org/jsapi/js/lib/ts/core.js"></script>
 <script type="text/javascript" src="http://static.torrentstream.org/jsapi/js/lib/jquery/jquery-1.7.min.js"></script>
 <script type="text/javascript" src="http://static.torrentstream.org/jsapi/js/lib/jquery/jquery.mousewheel.js"></script>
 <script type="text/javascript" src="http://static.torrentstream.org/jsapi/js/lib/jquery/jquery.easing.1.3.js"></script>
 <script type="text/javascript" src="http://static.torrentstream.org/jsapi/js/lib/jquery/jquery-ui-1.8.9.custom.min.js"></script>
 <script type="text/javascript" src="http://static.torrentstream.org/jsapi/js/lib/jquery/jquery.jscrollpane.js"></script>
 <script type="text/javascript" src="http://static.torrentstream.org/jsapi/js/lib/jquery/jquery.scrollText.js"></script>
 <script type="text/javascript" src="http://static.torrentstream.org/jsapi/js/lib/cufon/cufon.js"></script>
 <script type="text/javascript" src="http://static.torrentstream.org/jsapi/js/lib/cufon/a_LCDNova_400.font.js"></script>
 <script type="text/javascript" src="http://static.torrentstream.org/jsapi/js/lib/ts/player.js"></script>
 <script type="text/javascript" src="http://static.torrentstream.org/jsapi/js/lib/ts/controls.js"></script>

 <link type="text/css" rel="stylesheet" href="http://static.torrentstream.org/jsapi/css/ts-buttons.css" />
 <link type="text/css" rel="stylesheet" href="http://static.torrentstream.org/jsapi/css/ts-controls-white.css" />

 <script type="text/javascript">
    var controls = new TorrentStream.Controls(null, {
       style: "ts-white-screen"
    });
    function showPlayer(contentId) {
       controls.showPlayer(function() {
            try {
                var player = new TorrentStream.Player(this.getPluginContainer(), {
                        debug: true,
                        onLoad: function() {
                            this.registerEventHandler(controls);
                            controls.attachPlayer(this);
                            this.loadPlayer(contentId);
                        }
                });
            }
            catch(e) {
                controls.onSystemMessage(e);
            }
       });
    }
 </script>

Button to start the player

After pasting all scripts and styles create a button or link that will launch the player. Previously declared function showPlayer() must be called when pressing this button. This function takes one parameter: content identifier (content id). Example:

<input type="button" value="open" onclick="showPlayer('fa8ddccad4aea0a41d000a4f243c11dee99c4087');" />