16 |
16 |
17 if (this.url_transform) { |
17 if (this.url_transform) { |
18 this.video = this.url_transform(this.video); |
18 this.video = this.url_transform(this.video); |
19 } |
19 } |
20 |
20 |
21 if (/^(https?:\/\/)?(www\.)?vimeo\.com/.test(this.video)) { |
21 var _url = this.video; |
22 /* VIMEO */ |
22 |
23 var _popcorn = Popcorn.vimeo(this.container, this.video); |
23 if (/^(https?:\/\/)?(www\.)?youtube\.com/.test(this.video)) { |
24 } else if (/^(https?:\/\/)?(www\.)?youtube\.com/.test(this.video)) { |
|
25 /* YOUTUBE */ |
24 /* YOUTUBE */ |
26 var _urlparts = this.video.split(/[?&]/), |
25 var _urlparts = this.video.split(/[?&]/), |
27 _params = {}; |
26 _params = {}; |
28 for (var i = 1; i < _urlparts.length; i++) { |
27 for (var i = 1; i < _urlparts.length; i++) { |
29 var _ppart = _urlparts[i].split('='); |
28 var _ppart = _urlparts[i].split('='); |
34 if (this.autostart || this.autoplay) { |
33 if (this.autostart || this.autoplay) { |
35 _params.autoplay = 1; |
34 _params.autoplay = 1; |
36 } |
35 } |
37 _url = _urlparts[0] + '?' + IriSP.jQuery.param(_params); |
36 _url = _urlparts[0] + '?' + IriSP.jQuery.param(_params); |
38 |
37 |
39 var _popcorn = Popcorn.youtube(this.container, _url); |
38 }// else { |
|
39 // /* DEFAULT HTML5 */ |
|
40 // var _tmpId = IriSP._.uniqueId("popcorn"), |
|
41 // _videoEl = IriSP.jQuery('<video>'); |
|
42 // _videoEl.attr({ |
|
43 // id : _tmpId, |
|
44 // width : this.width, |
|
45 // height : this.height || undefined |
|
46 // }); |
|
47 // if(typeof this.video === "string"){ |
|
48 // _videoEl.attr("src",this.video); |
|
49 // } else { |
|
50 // for (var i = 0; i < this.video.length; i++) { |
|
51 // var _srcNode = IriSP.jQuery('<source>'); |
|
52 // _srcNode.attr({ |
|
53 // src: this.video[i].src, |
|
54 // type: this.video[i].type |
|
55 // }); |
|
56 // _videoEl.append(_srcNode); |
|
57 // } |
|
58 // } |
|
59 // this.$.html(_videoEl); |
|
60 // } |
40 |
61 |
41 } else { |
62 var _popcorn = Popcorn.smart("#"+this.container, _url); |
42 /* DEFAULT HTML5 */ |
63 |
43 var _tmpId = IriSP._.uniqueId("popcorn"), |
64 if (this.autostart || this.autoplay) { |
44 _videoEl = IriSP.jQuery('<video>'); |
65 _popcorn.autoplay(true); |
45 _videoEl.attr({ |
|
46 id : _tmpId, |
|
47 width : this.width, |
|
48 height : this.height || undefined |
|
49 }); |
|
50 if(typeof this.video === "string"){ |
|
51 _videoEl.attr("src",this.video); |
|
52 } else { |
|
53 for (var i = 0; i < this.video.length; i++) { |
|
54 var _srcNode = IriSP.jQuery('<source>'); |
|
55 _srcNode.attr({ |
|
56 src: this.video[i].src, |
|
57 type: this.video[i].type |
|
58 }); |
|
59 _videoEl.append(_srcNode); |
|
60 } |
|
61 } |
|
62 this.$.html(_videoEl); |
|
63 var _popcorn = Popcorn("#" + _tmpId); |
|
64 if (this.autostart || this.autoplay) { |
|
65 _popcorn.autoplay(true); |
|
66 } |
|
67 } |
66 } |
68 |
67 |
69 var _media = this.media; |
68 var _media = this.media; |
70 |
69 |
71 // Binding functions to Popcorn |
70 // Binding functions to Popcorn |
123 _popcorn.on("volumechange", function() { |
122 _popcorn.on("volumechange", function() { |
124 getVolume(); |
123 getVolume(); |
125 _media.trigger("volumechange"); |
124 _media.trigger("volumechange"); |
126 }); |
125 }); |
127 |
126 |
128 _popcorn.on("play", function() { |
127 _popcorn.on("play", function(e) { |
129 _media.trigger("play"); |
128 _media.trigger("play"); |
130 }); |
129 }); |
131 |
130 |
132 _popcorn.on("pause", function() { |
131 _popcorn.on("pause", function() { |
133 _media.trigger("pause"); |
132 _media.trigger("pause"); |