Created
August 16, 2016 16:01
-
-
Save HooFoo/ad4306972df450f7a47b09ae8d3f592a to your computer and use it in GitHub Desktop.
Tvigle bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.0.min.js"></script> | |
| </head> | |
| <body> | |
| <div> <script src="http://cloud.tvigle.ru/static/player/player_builder.min.js" type="text/javascript"> | |
| </script> | |
| <script type="text/javascript"> | |
| var Listener = function () { | |
| this.cbList = {}; | |
| this.tvglPlayerObj = null; | |
| }; | |
| Listener.prototype.on = function (name, cb) { | |
| this.cbList[name] = this.cbList[name] || []; | |
| this.cbList[name].push(cb); | |
| }; | |
| Listener.prototype.emit = function (name, args) { | |
| if (this.cbList[name.name]) { | |
| for (var i = 0; i < this.cbList[name.name].length; i++) { | |
| this.cbList[name.name][i].apply(this); | |
| } | |
| } | |
| }; | |
| Listener.prototype.proxy = function (name, args) { | |
| this.emit(name, args); | |
| }; | |
| Listener.prototype.ready = function () { | |
| // left for following legacy code cleanup | |
| }; | |
| Listener.prototype.load = function (e) { | |
| console.log(e); | |
| this.tvglPlayerObj = tvigle.api.getPlayer(e); | |
| }; | |
| Listener.prototype.getTvglPlayer = function() { | |
| return this.tvglPlayerObj.getModule(tvigle.api.modules.APIModules.VIDEO_PLAYER); | |
| }; | |
| var playerListener = new Listener(); | |
| </script> | |
| <div class="video-wrapper"> | |
| <div class="scaler"></div> | |
| <div class="player"> | |
| <object class="TviglePlayer"> | |
| <param name="id" value="2373981"> | |
| <param name="bgcolor" value="#000000"/> | |
| <param name="width" value="712"> | |
| <param name="height" value="400"> | |
| <param name="playerId" value="10"> | |
| <param name="useAPI" value="true"> | |
| <param name="autoChangeVideo" value="false"> | |
| <param name="autoStart" value="false"> | |
| <param name="navButtons" value="true"> | |
| <param name="forceFlashObject" value="true"> | |
| <param name="wmode" value="opaque"> | |
| <param name="eventHandler" value="playerListener.proxy"> | |
| <param name="templateLoadHandler" value="playerListener.load"> | |
| <param name="templateReadyHandler" value="playerListener.ready"> | |
| <param name="partnerId" value="8"> | |
| </object> | |
| </div> | |
| </div> | |
| </div> | |
| <script type="text/javascript" async> | |
| //let me show you some magic. | |
| tvigle.createPlayers(); | |
| var pause = function(){ | |
| var player = tvigle.api.getPlayer('tvPlayerObj0').getModule(tvigle.api.modules.APIModules.VIDEO_PLAYER); //it's not workin in this example with listener.load | |
| console.log(player); | |
| player.pauseVideo(); | |
| player.stopVideo(); | |
| }; | |
| playerListener.on('play',pause); | |
| playerListener.on('start',pause); | |
| playerListener.on('seek',pause); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment