Embedded Player/en

From Ace Stream Wiki
(Redirected from Embedded Player)
Jump to: navigation, search

Demo version

http://torrentstream.org/test-popup.html

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 by clicking this button. This function takes one parameter: content identifier (content id). Example:

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