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