forked from seanthegeek/Web4Radio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.html
149 lines (136 loc) · 6.13 KB
/
player.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
<!DOCTYPE html>
<!-- Web4Radio Player Copyright 2013 Sean Whalen. License: https://github.com/seanthegeek/Web4Radio/blob/master/LICENSE.txt -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Web4Radio Player</title>
<meta content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="//cdn.jsdelivr.net/normalize/2.1.1/normalize.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/jplayer/2.4.0/skin/blue.monday/jplayer.blue.monday.css">
<style>
div.jp-audio {
width:275px;
}
div.jp-audio div.jp-type-single a.jp-mute,
div.jp-audio div.jp-type-single a.jp-unmute {
margin-left:50px;
}
div.jp-audio div.jp-volume-bar {
left:130px;
}
.hidden {
display: none;
}
</style>
<!--[if lt IE 9]>
<script src="//cdn.jsdelivr.net/html5shiv/3.6.1/html5shiv.min.js"></script>
<![endif]-->
<script>
"use strict";
// Start Web4Radio options
var streamName = ""; // Station name
var streamAddress = ""; // Streaming server address
var streamPort = 80; // Streaming server port
var mp3Mount = ""; // Leave empty if shoutcast; no /
var oggMount = ""; // Leave empty if you don't have an ogg stream; no /
var autoPlay = true; // Automatic play - true of false - does not work for Android browsers
// End Web4radio options
</script>
</head>
<body>
<div id="web4radio_1" class="jp-jplayer"></div>
<div id="jp_container_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-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>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
<div class="jp-time-holder">
<div class="jp-current-time"></div>
</div>
<div class="jp-title">
<ul>
<li id="title"></li>
<li id="current_song"></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> <!-- End #jp_container_1 -->
</div> <!-- End .jp-type-single -->
</div> <!-- End .jp-gui .jp-interface -->
<p id="android" class="hidden">Android users need to press play</p>
<div id="old-android" class="hidden">
<p>Your browser is not compatible with the plaver. Mozilla Firefox for Android is.</p>
<a href="https://play.google.com/store/apps/details?id=org.mozilla.firefox">Get Firefox</a>
</div>
<script src="//cdn.jsdelivr.net/jquery/1.9.1/jquery-1.9.1.min.js"></script>
<script src="//cdn.jsdelivr.net/jplayer/2.4.0/jquery.jplayer.min.js"></script>
<script>
"use strict";
$(document).ready(function(){
var android = navigator.userAgent.indexOf("Android") !== -1;
var baseUrl = "http://" + streamAddress + ":" + streamPort + "/";
var formats = "";
if (mp3Mount === "" && oggMount === "")
{
// We have a shoutcast stream, override UA detection
mp3Mount = ";";
}
if (mp3Mount != "")
{
formats = "mp3";
if (oggMount != "")
{
formats += ", oga";
}
}
else if (oggMount != "")
{
formats = "oga";
}
$("title").text(streamName + " Player");
$("#title").text(streamName);
$("#web4radio_1").bind($.jPlayer.event.play, function(event) {
if (android) {$("#android").hide();}
setTimeout(function() {
var time = $("#web4radio_1").data("jPlayer").status.currentTime
if (android && time === 0) {
// If playback didn't start by now, it's probably a stock browser on Android < 4.1
$("#web4radio_1").jPlayer("stop");
$("#old-android").show();
}
}, 6000)
});
if (android) {$("#android").show();}
$("#web4radio_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
oga: baseUrl + oggMount,
mp3: baseUrl + mp3Mount
})
if (autoPlay) {$(this).jPlayer("play");}
},
ended: function(event) {
$(this).jPlayer("play");
},
swfPath: "//cdn.jsdelivr.net/jplayer/2.4.0",
supplied: formats, // Prefer MP3 because OGG with metadata is buggy in Google Chrome
solution: "flash, html" // HTML5 does not recover from a broken connection in most browsers
});
});
</script>
</body>
</html>