|
1 IriSP.PlayerWidget.prototype = new IriSP.Widget; |
|
2 |
|
3 IriSP.PlayerWidget.prototype.draw = function() { |
|
4 var _this = this; |
|
5 var width = this._config.gui.width; |
|
6 var height = this._config.gui.height; |
|
7 var heightS = this._config.gui.height-20; |
|
8 |
|
9 if( this._config.gui.mode=="radio" ){ |
|
10 |
|
11 //IriSP.jQuery( "#"+this._config.gui.container ).before(IriSP.search_template); |
|
12 var radioPlayer = Mustache.to_html(IriSP.radio_template, {"share_template" : IriSP.share_template}); |
|
13 IriSP.jQuery(radioPlayer).appendTo("#"+this._config.gui.container); |
|
14 |
|
15 // special tricks for IE 7 |
|
16 if (IriSP.jQuery.browser.msie==true && IriSP.jQuery.browser.version=="7.0"){ |
|
17 //LdtSearchContainer |
|
18 //__IriSP.jQuery("#LdtPlayer").attr("margin-top","50px"); |
|
19 IriSP.jQuery("#Ldt-Root").css("padding-top","25px"); |
|
20 } |
|
21 } else if(this._config.gui.mode=="video") { |
|
22 |
|
23 var videoPlayer = Mustache.to_html(IriSP.video_template, {"share_template" : IriSP.share_template, "heightS" : heightS}); |
|
24 IriSP.jQuery(videoPlayer).appendTo("#"+this._config.gui.container); |
|
25 } |
|
26 |
|
27 IriSP.jQuery("#Ldt-Annotations").width(width-(75*2)); |
|
28 IriSP.jQuery("#Ldt-Show-Arrow-container").width(width-(75*2)); |
|
29 IriSP.jQuery("#Ldt-ShowAnnotation-audio").width(width-10); |
|
30 IriSP.jQuery("#Ldt-ShowAnnotation-video").width(width-10); |
|
31 IriSP.jQuery("#Ldt-SaKeyword").width(width-10); |
|
32 IriSP.jQuery("#Ldt-controler").width(width-10); |
|
33 IriSP.jQuery("#Ldt-Control").attr("z-index","100"); |
|
34 IriSP.jQuery("#Ldt-controler").hide(); |
|
35 |
|
36 IriSP.jQuery(IriSP.annotation_loading_template).appendTo("#Ldt-ShowAnnotation-audio"); |
|
37 |
|
38 if(this._config.gui.mode=='radio'){ |
|
39 IriSP.jQuery("#Ldt-load-container").attr("width",this._config.gui.width); |
|
40 } |
|
41 |
|
42 IriSP.jQuery( "#Ldt-controler" ).show(); |
|
43 //__IriSP.jQuery("#Ldt-Root").css('display','visible'); |
|
44 IriSP.jQuery( "#Ldt-ShowAnnotation").click( function () { |
|
45 //__IriSP.jQuery(this).slideUp(); |
|
46 } ); |
|
47 |
|
48 var LdtpPlayerY = IriSP.jQuery("#Ldt-PlaceHolder").attr("top"); |
|
49 var LdtpPlayerX = IriSP.jQuery("#Ldt-PlaceHolder").attr("left"); |
|
50 |
|
51 IriSP.jQuery( "#slider-range-min" ).slider( { //range: "min", |
|
52 value: 0, |
|
53 min: 1, |
|
54 max: this._serializer.currentMedia().meta["dc:duration"]/1000,//1:54:52.66 = 3600+3240+ |
|
55 step: 0.1, |
|
56 slide: function(event, ui) { |
|
57 _this._Popcorn.currentTime(ui.value); |
|
58 }, |
|
59 /* change event is similar to slide, but it happens when the slider position is |
|
60 modified programatically. We use it for unit tests */ |
|
61 /* |
|
62 change: function(event, ui) { |
|
63 _this._Popcorn.currentTime(ui.value); |
|
64 } |
|
65 */ |
|
66 } ); |
|
67 |
|
68 IriSP.jQuery("#amount").val(IriSP.jQuery("#slider-range-min").slider("value")+" s"); |
|
69 IriSP.jQuery(".Ldt-Control1 button:first").button({ |
|
70 icons: { |
|
71 primary: 'ui-icon-play' |
|
72 }, |
|
73 text: false |
|
74 }).click(function() { _this.playHandler.call(_this); }) |
|
75 .next().button({ |
|
76 icons: { |
|
77 primary: 'ui-icon-seek-next' |
|
78 }, |
|
79 text: false |
|
80 }); |
|
81 IriSP.jQuery(".Ldt-Control2 button:first").button({ |
|
82 icons: { |
|
83 primary: 'ui-icon-search'//, |
|
84 //secondary: 'ui-icon-volume-off' |
|
85 }, |
|
86 text: false |
|
87 }).next().button({ |
|
88 icons: { |
|
89 primary: 'ui-icon-volume-on' |
|
90 }, |
|
91 text: false |
|
92 }).click(function() { _this.muteHandler.call(_this); } ); |
|
93 |
|
94 // /!\ PB A MODIFIER |
|
95 //__IriSP.MyTags.draw(); |
|
96 IriSP.jQuery( "#ldt-CtrlPlay" ).attr( "style", "background-color:#CD21C24;" ); |
|
97 |
|
98 IriSP.jQuery( "#Ldt-load-container" ).hide(); |
|
99 |
|
100 if( this._config.gui.mode=="radio" & IriSP.jQuery.browser.msie != true ) { |
|
101 IriSP.jQuery( "#Ldtplayer1" ).attr( "height", "0" ); |
|
102 } |
|
103 |
|
104 this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.sliderUpdater)); |
|
105 }; |
|
106 |
|
107 IriSP.PlayerWidget.prototype.playHandler = function() { |
|
108 var status = this._Popcorn.media.paused; |
|
109 |
|
110 if ( status == true ){ |
|
111 this._Popcorn.play(); |
|
112 IriSP.jQuery( ".ui-icon-play" ).css( "background-position", "-16px -160px" ); |
|
113 IriSP.jQuery( "#ldt-CtrlPlay" ).attr("title", "Play"); |
|
114 } else { |
|
115 this._Popcorn.pause(); |
|
116 IriSP.jQuery( ".ui-icon-play" ).css( "background-position","0px -160px" ); |
|
117 IriSP.jQuery( "#ldt-CtrlPlay" ).attr("title", "Pause"); |
|
118 } |
|
119 }; |
|
120 |
|
121 IriSP.PlayerWidget.prototype.muteHandler = function() { |
|
122 if (!this._Popcorn.muted()) { |
|
123 this._Popcorn.mute(true); |
|
124 IriSP.jQuery(" .ui-icon-volume-on ").css("background-position", "-130px -160px"); |
|
125 } else { |
|
126 this._Popcorn.mute(false); |
|
127 IriSP.jQuery( ".ui-icon-volume-on" ).css("background-position", "-144px -160px" ); |
|
128 } |
|
129 }; |
|
130 |
|
131 IriSP.PlayerWidget.prototype.sliderUpdater = function() { |
|
132 var currentPosition = this._Popcorn.currentTime(); |
|
133 IriSP.jQuery( "#slider-range-min" ).slider( "value", currentPosition); |
|
134 }; |
|
135 |