-
Notifications
You must be signed in to change notification settings - Fork 6
/
show-time-left.both.html
172 lines (161 loc) · 5.75 KB
/
show-time-left.both.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>jPlayer Example: Showing the time left</title>
<link href="skin/pink.flag/jplayer.pink.flag.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="lib/jquery-1.10.2.js"></script>
<script type="text/javascript" src="lib/jquery.jplayer.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
var prepareTimeLeft = function(event) {
var $time = $(event.jPlayer.options.cssSelectorAncestor + " .jp-current-time");
$(this).data('$time', $time);
}
var showTimeLeft = function(event) {
var timeLeft = event.jPlayer.status.duration - event.jPlayer.status.currentTime,
timeDisplay = '-' + $.jPlayer.convertTime(timeLeft),
$time = $(this).data('$time');
if($time) {
$time.text(timeDisplay);
}
};
// Audio
$('#jplayer_audio_1').jPlayer({
ready: function(event) {
prepareTimeLeft.call(this, event);
$(this).jPlayer('setMedia', {
mp3: 'http://www.jplayer.org/audio/mp3/Miaow-07-Bubble.mp3',
oga: 'http://www.jplayer.org/audio/ogg/Miaow-07-Bubble.ogg'
});
},
timeupdate: showTimeLeft,
durationchange: showTimeLeft,
play: function() {
$(this).jPlayer('pauseOthers');
},
cssSelectorAncestor: '#jp_gui_audio_1',
cssSelector: {
currentTime: ''
},
swfPath: 'lib',
supplied: 'oga, mp3',
smoothPlayBar: true,
keyEnabled: true,
wmode: 'window'
});
// Video
$('#jplayer_video_1').jPlayer({
ready: function(event) {
prepareTimeLeft.call(this, event);
$(this).jPlayer('setMedia', {
m4v: 'http://jplayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v',
webmv: 'http://jplayer.org/video/webm/Big_Buck_Bunny_Trailer.webm',
poster: 'http://jplayer.org/video/poster/Big_Buck_Bunny_Trailer_480x270.png'
});
},
timeupdate: showTimeLeft,
durationchange: showTimeLeft,
play: function() {
$(this).jPlayer('pauseOthers');
},
cssSelectorAncestor: '#jp_gui_video_1',
cssSelector: {
currentTime: ''
},
swfPath: 'lib',
supplied: 'webmv, m4v',
smoothPlayBar: true,
keyEnabled: true
});
});
</script>
</head>
<body>
<div id="jplayer_audio_1" class="jp-jplayer"></div>
<div id="jp_gui_audio_1" class="jp-audio">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<ul class="jp-controls">
<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
<li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
<li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
<li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
<li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>
</ul>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
<div class="jp-current-time"></div>
<div class="jp-duration"></div>
<ul class="jp-toggles">
<li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li>
<li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off">repeat off</a></li>
</ul>
</div>
<div class="jp-title">
<ul>
<li>Bubble</li>
</ul>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>
<div id="jp_gui_video_1" class="jp-video jp-video-270p">
<div class="jp-type-single">
<div id="jplayer_video_1" class="jp-jplayer"></div>
<div class="jp-gui">
<div class="jp-video-play">
<a href="javascript:;" class="jp-video-play-icon" tabindex="1">play</a>
</div>
<div class="jp-interface">
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time"></div>
<div class="jp-duration"></div>
<div class="jp-title">
<ul>
<li>Big Buck Bunny Trailer</li>
</ul>
</div>
<div class="jp-controls-holder">
<ul class="jp-controls">
<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
<li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
<li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
<li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
<li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>
</ul>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
<ul class="jp-toggles">
<li><a href="javascript:;" class="jp-full-screen" tabindex="1" title="full screen">full screen</a></li>
<li><a href="javascript:;" class="jp-restore-screen" tabindex="1" title="restore screen">restore screen</a></li>
<li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li>
<li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off">repeat off</a></li>
</ul>
</div>
</div>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>
</body>
</html>