18 |
18 |
19 var Player_templ = Mustache.to_html(IriSP.player_template, {"share_template" : IriSP.share_template}); |
19 var Player_templ = Mustache.to_html(IriSP.player_template, {"share_template" : IriSP.share_template}); |
20 this.selector.append(Player_templ); |
20 this.selector.append(Player_templ); |
21 |
21 |
22 this.selector.children(".Ldt-controler").width(width - 10); |
22 this.selector.children(".Ldt-controler").width(width - 10); |
23 /* |
|
24 this.selector.children("#Ldt-Control").attr("z-index", "100"); |
|
25 this.selector.children("#Ldt-controler").hide(); |
|
26 */ |
|
27 |
23 |
28 this.selector.children(".Ldt-controler").show(); |
24 this.selector.children(".Ldt-controler").show(); |
29 |
|
30 var LdtpPlayerY = this.selector.children("#Ldt-PlaceHolder").attr("top"); |
|
31 var LdtpPlayerX = this.selector.children("#Ldt-PlaceHolder").attr("left"); |
|
32 |
25 |
33 // handle clicks by the user on the video. |
26 // handle clicks by the user on the video. |
34 this._Popcorn.listen("play", IriSP.wrap(this, this.playButtonUpdater)); |
27 this._Popcorn.listen("play", IriSP.wrap(this, this.playButtonUpdater)); |
35 this._Popcorn.listen("pause", IriSP.wrap(this, this.playButtonUpdater)); |
28 this._Popcorn.listen("pause", IriSP.wrap(this, this.playButtonUpdater)); |
|
29 this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeDisplayUpdater)); |
36 |
30 |
37 this.selector.children("#amount").val(this.selector.children("#slider-range-min").slider("value")+" s"); |
|
38 |
31 |
39 this.selector.find(".ldt-CtrlPlay").button({ |
32 this.selector.find(".ldt-CtrlPlay").button({ |
40 icons: { |
33 icons: { |
41 primary: 'ui-icon-play' |
34 primary: 'ui-icon-play' |
42 }, |
35 }, |
63 }, |
56 }, |
64 text: false |
57 text: false |
65 }).click(function() { self.muteHandler.call(self); } ); |
58 }).click(function() { self.muteHandler.call(self); } ); |
66 |
59 |
67 this.selector.find(".ldt-CtrlPlay").attr( "style", "background-color:#CD21C24;" ); |
60 this.selector.find(".ldt-CtrlPlay").attr( "style", "background-color:#CD21C24;" ); |
|
61 }; |
|
62 |
|
63 /* Update the elasped time div */ |
|
64 IriSP.PlayerWidget.prototype.timeDisplayUpdater = function() { |
68 |
65 |
69 // this.selector.children("#Ldt-load-container").hide(); |
66 if (this._previousSecond === undefined) |
|
67 this._previousSecond = this._Popcorn.roundTime(); |
70 |
68 |
71 if( this._config.mode=="radio" & IriSP.jQuery.browser.msie != true ) { |
69 else { |
72 IriSP.jQuery( "#Ldtplayer1" ).attr( "height", "0" ); |
70 /* we're still in the same second, so it's not necessary to update time */ |
|
71 if (this._Popcorn.roundTime() == this._previousSecond) |
|
72 return; |
|
73 |
73 } |
74 } |
74 |
75 |
75 |
76 // we get it at each call because it may change. |
|
77 var duration = +this._serializer.currentMedia().meta["dc:duration"]; |
|
78 var totalTime = IriSP.secondsToTime(duration); |
|
79 var elapsedTime = IriSP.secondsToTime(this._Popcorn.currentTime()); |
|
80 |
|
81 var timeTemplate = "{{hours}}:{{minutes}}:{{seconds}}"; |
|
82 this.selector.find(".ElapsedTime").html(Mustache.to_html(timeTemplate, elapsedTime)); |
|
83 this.selector.find(".TotalTime").html(Mustache.to_html(timeTemplate, totalTime)); |
|
84 |
|
85 this._previousSecond = this._Popcorn.roundTime(); |
76 }; |
86 }; |
77 |
87 |
78 /* update the icon of the button - separate function from playHandler |
88 /* update the icon of the button - separate function from playHandler |
79 because in some cases (for instance, when the user directly clicks on |
89 because in some cases (for instance, when the user directly clicks on |
80 the jwplayer window) we have to change the icon without playing/pausing |
90 the jwplayer window) we have to change the icon without playing/pausing |