| author | Gautier Thibault <gthibault@universcine.com> |
| Tue, 22 Sep 2009 16:40:38 +0200 | |
| changeset 35 | 94a1dc255022 |
| permissions | -rw-r--r-- |
|
35
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
1 |
uc = uc || {}; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
2 |
uc.player = uc.player || {}; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
3 |
uc.player.classIdExpr = /media-(\S+)-(\S+)/; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
4 |
uc.player.jsLoaded = false; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
5 |
uc.player.skins = { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
6 |
universcine: { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
7 |
// display properties such as size, location and opacity |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
8 |
bottom: 0, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
9 |
height: 24, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
10 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
11 |
// progress bar |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
12 |
progressColor: '#990000', |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
13 |
bufferColor: '#333333', |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
14 |
SliderColor: '#333333', |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
15 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
16 |
// buttons |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
17 |
buttonColor: '#990000', |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
18 |
buttonColorOver: '#999999', |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
19 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
20 |
// styling properties (will be applied to all plugins) |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
21 |
backgroundColor: '#000000', |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
22 |
backgroundGradient: 'none', |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
23 |
opacity: 0.8, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
24 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
25 |
// controlbar specific settings |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
26 |
autoHide: true, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
27 |
all: false, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
28 |
play: true, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
29 |
scrubber: true, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
30 |
mute: true, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
31 |
volume: true, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
32 |
fullscreen: true, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
33 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
34 |
// a little more styling |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
35 |
width: '99%', |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
36 |
bottom: 2, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
37 |
left: '50%', |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
38 |
borderRadius: 5 |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
39 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
40 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
41 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
42 |
uc.player.conf = { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
43 |
video: { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
44 |
clip: { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
45 |
autoPlay: true, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
46 |
autoBuffering: true, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
47 |
scaling: 'fit' |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
48 |
}, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
49 |
plugins: { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
50 |
controls: uc.player.skins.universcine |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
51 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
52 |
}, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
53 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
54 |
slideshow: { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
55 |
clip: { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
56 |
autoPlay: true, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
57 |
autoBuffering: false, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
58 |
scaling: 'fit' |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
59 |
}, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
60 |
plugins: { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
61 |
controls: null |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
62 |
}, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
63 |
play: { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
64 |
opacity:0 |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
65 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
66 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
67 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
68 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
69 |
uc.player.currentPlayer = null; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
70 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
71 |
uc.player.loadJS = function(callback) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
72 |
// Preload flowplayer |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
73 |
jQuery.getScript('/js/flowplayer/flowplayer-3.1.0.min.js', function () { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
74 |
jQuery.getScript('/js/flowplayer/flowplayer.playlist-3.0.5.min.js', function () { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
75 |
uc.player.jsLoaded = true; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
76 |
callback(); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
77 |
}); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
78 |
}); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
79 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
80 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
81 |
uc.player.mediaPlayer = function(node) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
82 |
this.jq_playlist = jQuery(node); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
83 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
84 |
// Extract playlist id |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
85 |
var matches = this.jq_playlist.attr('id').match(uc.player.classIdExpr); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
86 |
this.playlist_id = matches[2]; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
87 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
88 |
// Get default playlist |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
89 |
this.default_playlist = 'image'; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
90 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
91 |
if (jQuery('.video-playlist.default-playlist', this.jq_playlist).length == 1) this.default_playlist = 'video'; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
92 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
93 |
// Extract video playlist |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
94 |
this.video_playlist = []; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
95 |
var self = this; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
96 |
jQuery('.video-playlist .media-item', this.jq_playlist).each(function(index) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
97 |
var jq_this = jQuery(this); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
98 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
99 |
// Extract media info |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
100 |
var media_item = {uri: null, thumb_uri: null}; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
101 |
var jq_uri = jQuery('.media-uri', jq_this); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
102 |
media_item.uri = jq_uri.attr('href'); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
103 |
var jq_thumb_uri = jQuery('.media-thumb-uri', jq_this); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
104 |
if (jq_thumb_uri.length == 1) media_item.thumb_uri = jq_thumb_uri.attr('href'); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
105 |
self.video_playlist[index] = media_item; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
106 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
107 |
// Wrap media click |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
108 |
jq_uri.attr('href', 'javascript:void(0)'); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
109 |
jq_uri.click(function () { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
110 |
self.playVideo(index); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
111 |
}); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
112 |
}); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
113 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
114 |
// Extract image playlist |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
115 |
this.image_playlist = []; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
116 |
var self = this; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
117 |
jQuery('.image-playlist .media-item', this.jq_playlist).each(function(index) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
118 |
var jq_this = jQuery(this); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
119 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
120 |
// Extract media info |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
121 |
var media_item = {uri: null}; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
122 |
var jq_uri = jQuery('.media-uri', jq_this); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
123 |
media_item.uri = jq_uri.attr('href'); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
124 |
self.image_playlist[index] = media_item; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
125 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
126 |
// Wrap media click |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
127 |
jq_uri.attr('href', 'javascript:void(0)'); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
128 |
jq_uri.click(function () { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
129 |
self.playSlideShow(index); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
130 |
}); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
131 |
}); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
132 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
133 |
// Search the place to include the media player |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
134 |
this.jq_player_wrapper = jQuery('<div class="media-player-wrapper" id="media-player-wrapper-' + this.playlist_id + '"> </div>'); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
135 |
jq_place = jQuery('.media-player-after', this.jq_playlist); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
136 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
137 |
if (jq_place.length == 1) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
138 |
jq_place.after(this.jq_player_wrapper); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
139 |
} else { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
140 |
jq_place = jQuery('.media-player-before', this.jq_playlist); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
141 |
jq_place.before(this.jq_player_wrapper); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
142 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
143 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
144 |
this.showPlayer(); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
145 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
146 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
147 |
uc.player.mediaPlayer.prototype = { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
148 |
removePlayer: function() { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
149 |
jQuery('.media-player', this.jq_player_wrapper).unload(); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
150 |
jQuery('*', this.jq_player_wrapper).remove(); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
151 |
}, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
152 |
stopPlayer: function() { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
153 |
this.removePlayer(); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
154 |
this.showPlayer(); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
155 |
}, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
156 |
showPlayer: function() { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
157 |
var jq_play_button = jQuery('<a class="play-button">Play</a>'); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
158 |
var self = this; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
159 |
this.jq_player_wrapper.append(jq_play_button); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
160 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
161 |
// Get default media |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
162 |
var default_media = null; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
163 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
164 |
if (this.default_playlist == 'video') { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
165 |
default_media = this.video_playlist[0]; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
166 |
jq_play_button.click(function() {self.playVideo(0)}); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
167 |
} else { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
168 |
default_media = this.image_playlist[0]; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
169 |
default_media.thumb_uri = default_media.uri; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
170 |
jq_play_button.click(function() {self.playSlideShow(0)}); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
171 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
172 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
173 |
if (default_media.thumb_uri) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
174 |
// Add background to player |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
175 |
this.jq_player_wrapper.css('background-image', 'url(' + default_media.thumb_uri + ')'); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
176 |
this.jq_player_wrapper.css('background-repeat', 'no-repeat'); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
177 |
this.jq_player_wrapper.css('background-position', '50% 0%'); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
178 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
179 |
}, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
180 |
createPlayer: function(media, conf) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
181 |
// Stop current player |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
182 |
var current_player = uc.player.currentPlayer; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
183 |
if (current_player && current_player.playlist_id != this.playlist_id) current_player.stopPlayer(); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
184 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
185 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
186 |
// Create new player |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
187 |
this.removePlayer(); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
188 |
uc.player.currentPlayer = this; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
189 |
this.jq_player_wrapper.append('<a id="media-player-' + this.playlist_id + '" class="media-player" href="' + media.uri + '"/>'); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
190 |
return flowplayer('media-player-' + this.playlist_id, {src: '/swf/flowplayer-3.1.0.swf', wmode: 'opaque'}, conf); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
191 |
}, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
192 |
playVideo: function(index) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
193 |
var media = this.video_playlist[index]; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
194 |
var conf = uc.player.conf.video; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
195 |
conf.playlist = []; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
196 |
conf.playlist.push({url: media.uri}); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
197 |
this.createPlayer(media, conf); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
198 |
}, |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
199 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
200 |
playSlideShow: function(index) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
201 |
var conf = uc.player.conf.slideshow; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
202 |
var duration = 5; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
203 |
conf.playlist = []; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
204 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
205 |
for (var i=index; i<this.image_playlist.length; i++) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
206 |
conf.playlist.push({url: this.image_playlist[i].uri, duration: duration, scaling: true}); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
207 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
208 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
209 |
for (var i=0; i<index; i++) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
210 |
conf.playlist.push({url: this.image_playlist[i].uri, duration: duration, scaling: true}); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
211 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
212 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
213 |
// Add loop features if there are more than one items |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
214 |
if (conf.playlist.length > 1) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
215 |
conf.playlist[conf.playlist.length - 1].onBeforeFinish = function () {return false;} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
216 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
217 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
218 |
var media = this.image_playlist[index]; |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
219 |
this.createPlayer(media, conf); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
220 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
221 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
222 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
223 |
uc.player.initPlayer = function(selector) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
224 |
jQuery(selector).each(function($index) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
225 |
var player = new uc.player.mediaPlayer(this); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
226 |
}); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
227 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
228 |
|
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
229 |
uc.player.build = function (selector) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
230 |
if (!uc.player.jsLoaded && jQuery(selector).length > 0) { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
231 |
uc.player.loadJS(function() {uc.player.initPlayer(selector);}); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
232 |
} else { |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
233 |
uc.player.initPlayer(selector); |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
234 |
} |
|
94a1dc255022
Commit the all thd project created with the framework symfony
Gautier Thibault <gthibault@universcine.com>
parents:
diff
changeset
|
235 |
} |