-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo.html
239 lines (196 loc) · 7.69 KB
/
demo.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>jPlayer Playlist Example - jsFiddle demo by onigetoc</title>
<link rel="stylesheet" type="text/css" href="skin/pink.flag/jplayer.pink.flag.css">
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js'></script>
<script type='text/javascript' src="js/jquery.jplayer.min.js"></script>
<script type='text/javascript' src="js/jplayer.playlist.min.js"></script>
<style type='text/css'>
.jp-playlist {
max-height: 200px;
width: 100%;
height: 100%;
padding-right: 20px;
overflow-x: hidden;
overflow-y: auto;
/*For mobile scroll*/
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
}
</style>
<script type='text/javascript'>
$(document).ready(function () {
var myPlaylist = new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1",
},
// On loading get the first option value selected in the drop down
loadPodcast( $("#drop-playlist option:selected").val() ),
{
playlistOptions: {autoPlay: true},
swfPath: "js/Jplayer.swf",
supplied: "mp3,oga,m4a,m4v,mp4",
solution: "flash, html",
wmode: "window",
smoothPlayBar: true,
keyEnabled: true,
/* Need it to show podcast poster*/
size: {
width: "243px",
height: "243px",
cssClass: "jp-poster"
}
});
//$("#jplayer_inspector_1").jPlayerInspector({jPlayer:$("#jquery_jplayer_1")});
/*************** PODPARSER *******************/
// Drop down playlist
$("#drop-playlist").change(function () {
var Podurl = this.value;
loadPodcast(Podurl);
});
/// Load form
$("#loadPlaylist").submit(function (e) {
e.preventDefault();
var Podurl = $("#Podurl").val();
loadPodcast(Podurl);
});
$("#playlist2").click(function() {
myPlaylist.play(1); // play song 2
});
// Call podparser php
function loadPodcast(Podurl) {
$.getJSON("assets/podparser.php?callback=?&Podurl="+Podurl, {},function (playlist){
console.log(playlist);
myPlaylist.setPlaylist(playlist);
});
}
//end PodParser
// Test add song and play
$("#addToPlaylist").submit(function (e) {
e.preventDefault();
var Podurl = $("#addToPlaylist-Input").val();
loadPodcast(Podurl);
var contentType = getContentType(Podurl);
console.log(contentType);
var filename = Podurl.match(/([^\/]+)(?=\.\w+$)/)[0];
filename = filename.replace(/-/g, ' ');
filename = filename.replace(/_/g, ' ');
var jpadd = {};
jpadd[contentType] = Podurl;
jpadd.title = filename;
jpadd.artist = "Test artist";
//jpadd.poster = this_poster;
myPlaylist.add(jpadd, true);
});
function getContentType(url) {
var ext = url.split('.').pop();
if (ext) {
//return formats[i].type + "/" + ext;
if ( (ext == "mp4") || (ext == "webm") ) ext = "m4v";
if (ext == "ogg") ext = "oga";
return ext;
}
// it doesn't matter now, as it's unsupported.
return "";
}
}); // Ready end
</script>
</head>
<body>
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<div id="jp_container_1" class="jp-audio">
<div class="jp-type-playlist">
<div class="jp-gui jp-interface">
<ul class="jp-controls">
<li><a href="javascript:;" class="jp-previous" tabindex="1">previous</a>
</li>
<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-next" tabindex="1">next</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-shuffle" tabindex="1" title="shuffle">shuffle</a>
</li>
<li><a href="javascript:;" class="jp-shuffle-off" tabindex="1" title="shuffle off">shuffle off</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>
<!--<li><a class="jp-full-screen" title="full screen" tabindex="1" href="javascript:;">full screen</a></li>
<li><a class="jp-restore-screen" title="restore screen" tabindex="1" href="javascript:;">restore screen</a></li> -->
</ul>
</div>
<div class="jp-playlist">
<ul>
<li></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>
<br>
<!--Load Podcast -->
<div class="podparser-loader" style="position:absolute; top:20px; left:300px;">
<h1>jPlayer Podcast Player</h1>
<p>DropDown load Podcast Playlist: <br>
<select id="drop-playlist" style="width: 240px;">
<option value="">Select Podcast</option>
<option value="http://feeds.twit.tv/twit" selected>This Week in Tech</option>
<option value="http://podcast.armadamusic.com/asot/podcast.xml">A State of Trance Official Podcast</option>
<option value="http://downloads.bbc.co.uk/podcasts/worldservice/globalnews/rss.xml">BBC News</option>
<option value="http://www.thecurrent.org/collection/song-of-the-day/rss">Current Song of the Day</option>
<option value="http://www.foxsportsradio.com/podcast/itunes/Jay_Mohr_Sports_Hours_itunes.xml">Jay Mohr Sports</option>
<option value="http://nerdist.libsyn.com/rss">The Nerdist</option>
<option value="http://feeds.feedburner.com/tedtalks_video">Video Podcast: Ted Talk</option>
<option value="http://www.france24.com/static/podcast/fr/REPORTAGES/reportages-fr.xml">Video Podcast: France 24</option>
</select>
</p>
<p>-------------------------------------<br>
</p>
<form id="loadPlaylist" action="">Enter Podcast URL:
<br>
<input name="Podurl" type="text" id="Podurl" value="http://www.hbo.com/podcasts/billmaher/podcast.xml" size="50">
<input type="submit" value="Submit">
</form>
<br>
<p>-------------------------------------<br>
<form id="addToPlaylist" action="">Enter audio URL:
<br>
<input name="addToPlaylist-Input" type="text" id="addToPlaylist-Input" value="http://www.jplayer.org/audio/mp3/TSP-05-Your_face.mp3" size="50">
<input type="submit" value="Submit">
</form>
<br>
<p>-------------------------------------<br>
<br>
<button type="button" id="playlist2" >Play no. 2</button>
<!--Load Podcast end -->
<br><br><br>
<div><a href="http://jsfiddle.net/onigetoc/2mb5C/show" target="_blank">Find Itune podcast feed url</a></div>
</div>
</body>
</html>