-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
174 lines (161 loc) · 4.84 KB
/
index.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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Radio4000 player</title>
<style>
/* styles for this demo */
body {
margin: 0;
padding: 2rem;
}
details {
margin-bottom: 1rem;
}
summary {
font-size: 1.2rem;
}
</style>
</head>
<body>
<p>
<nav>
<a href="/">Home</a>
</nav>
</p>
<p>See to follwing examples for a few different ways to start playing. Inspect the code of this page to see how it works. For more details, see the complete documentation.</p>
<details open="true">
<summary>channel-slug="oskar"</summary>
<radio4000-player channel-slug="oskar" query="test"></radio4000-player>
</details>
<details>
<summary>track-id="-KdVUsr70yYdIoBDmL43"</summary>
<radio4000-player></radio4000-player>
</details>
<details>
<summary>channel-id="-KFzPXLNzmKjPGwyY-xx"</summary>
<radio4000-player channel-id="-KFzPXLNzmKjPGwyY-xx"></radio4000-player>
</details>
<!-- tests -->
<!-- <radio4000-player channel-slug="ko002" autoplay="true"></radio4000-player> -->
<!-- <radio4000-player channel-slug="ko002" shuffle="true"></radio4000-player> -->
<details>
<summary>dead track link</summary>
<radio4000-player track-id="-JyCMmQETox_SF6-x6Tr"></radio4000-player>
</details>
<details>
<summary>Media is a local/remote audio file-player</summary>
<radio4000-player id="playlist-player" autoplay="false"></radio4000-player>
</details>
<details open>
<summary>test with UI options</summary>
<radio4000-player channel-slug="oskar" show-header="false" show-tracklist="false" show-controls="false"></radio4000-player>
</details>
<script>
/* defined globally some data for bellow,
we will use this in the player */
var tracks = [
{
id: '2',
title: 'A track with a bad mediaUrl',
url: '~/me.mp3'
},
{
id: '3',
title: 'Tittums.ogg',
url: 'https://upload.wikimedia.org/wikipedia/commons/e/ef/Tittums.ogg'
},
{
title: 'Blue tit',
url: 'https://upload.wikimedia.org/wikipedia/commons/7/7a/Neural-Correlates-of-Natural-Human-Echolocation-in-Early-and-Late-Blind-Echolocation-Experts-pone.0020162.s021.ogg'
},
{
id: 'OkR7UNnQU6c',
title: 'youtube test',
url: 'https://www.youtube.com/watch?v=OkR7UNnQU6c'
},
{
id: 'iiiOkR7UNnQU6c',
title: 'youtube test identical id as above',
url: 'https://www.youtube.com/watch?v=OkR7UNnQU6c'
},
{
title: 'black focus youtube',
url: 'https://www.youtube.com/watch?v=4D8YPDdsxYU'
},
{
title: 'vimeo long',
url: 'https://vimeo.com/36579366'
},
{
title: 'youtube jazz',
url: 'https://www.youtube.com/watch?v=s0lKUfOAWj8'
},
{
id: '343084593',
title: 'vimeo short',
url: 'https://vimeo.com/343084593'
},
{
title: 'soundcloud track',
url: 'https://soundcloud.com/lyl_radio/sur-ecoute-250419-w-pam-belec-danse-toujours-sainte-rita'
},
{
title: 'soundcloud set',
url: 'https://soundcloud.com/lyl_radio/sets/lyl-ra-at-dizonord'
},
{
title: 'soundcloud track repetitis',
url: 'https://soundcloud.com/short/bennett-short-dus-wat'
},
{
id: '1',
title: 'Birds_Polyphonic.ogg',
url: 'https://upload.wikimedia.org/wikipedia/commons/5/53/Birds_Polyphonic.ogg'
},
];
// a playlist, which includes the tracks
var playlist = {
title: 'title for this list',
image: 'https://78.media.tumblr.com/5080191d7d19fe64da558f2b4324563e/tumblr_p8eoiltn1t1twkjb3o1_1280.png',
tracks: tracks
};
</script>
<script>
/*
an example on how to init a player with:
- event listeners
- adding a playlist to play, when player is ready
For data, look at top of this file
*/
var initPlayer = function(playerDom, dataToPlay) {
// and add event listeners
playerDom.addEventListener('playerReady', () => {
console.info('r4player:playerReady')
var playerVue = playerDom.getVueInstance()
if (dataToPlay) {
playerVue.updatePlaylist(dataToPlay)
}
})
playerDom.addEventListener('trackChanged', (event) => {
console.info('r4player:trackChanged', event.detail[0])
})
playerDom.addEventListener('trackEnded', (event) => {
console.info('r4player:trackEnded', event.detail[0])
})
playerDom.addEventListener('mediaNotAvailable', (event) => {
console.info('r4player:mediaNotAvailable', event.detail[0])
})
}
// let's target the player we want to initialize with this data
var $player = document.querySelector('#playlist-player')
// where we initialize the player
// with a dom element, and a playlist data.
// playlist is defined at the top of this file
if ($player) {
initPlayer($player, playlist)
}
</script>
</body>
</html>