miniradio_server 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/miniradio_server/app.rb +1 -0
- data/lib/miniradio_server/templ/index.html.slim +26 -4
- data/lib/miniradio_server/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f70ca64739dfbd93c1badac47fb27cfde9a116c7386284f80becd71c018f091d
|
4
|
+
data.tar.gz: 9232efa32e08339a155806b2e986c93310840c2d4ad48f6f57adb01227463d2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2faf237ac46476883a6a5299d5da982d45c9fbb547154871c60587237bde37a6d9b66ae45cd7db2127736d37c7d0e3a8509730e0fd5c51fa12b5fa20e9fc28ed
|
7
|
+
data.tar.gz: 6ae6dabe71bb1d51ba29f60c1c2f2389b1029a9657c19a3e5558c342db6884f5cd1f324762988a62bb39e6e9fb5271ee7f1b83401d6ba4bbe3b3d855b6e93d8d
|
data/README.md
CHANGED
@@ -105,12 +105,12 @@ bin/miniradio_server
|
|
105
105
|
|
106
106
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
107
107
|
|
108
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
108
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org/gems/miniradio_server).
|
109
109
|
|
110
110
|
## ToDo
|
111
111
|
|
112
112
|
* Continuous playback of multiple Music tracks
|
113
|
-
* Use hls.js to support playback in Chrome
|
113
|
+
* :white_check_mark: ~~Use hls.js to support playback in Chrome.~~
|
114
114
|
* :white_check_mark: ~~Rendering of the Delivered Music list page~~
|
115
115
|
* :white_check_mark: ~~Multilingual support for file names.~~
|
116
116
|
|
data/lib/miniradio_server/app.rb
CHANGED
@@ -6,23 +6,45 @@ html
|
|
6
6
|
title Miniradio Server
|
7
7
|
link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css" type="text/css"
|
8
8
|
link rel="stylesheet" href="style/main.css" type="text/css"
|
9
|
+
script src="https://cdn.jsdelivr.net/npm/hls.js@1"
|
9
10
|
body
|
10
11
|
h1 Straming List
|
11
12
|
table.compact.striped
|
12
13
|
thead
|
13
14
|
tr
|
14
|
-
th scope="col"
|
15
|
+
th scope="col" Play
|
15
16
|
th scope="col" Title
|
16
17
|
th scope="col" Artist
|
17
18
|
th scope="col" Album
|
18
19
|
tbody
|
19
20
|
- mp3_list.each_with_index do |mp3, i|
|
20
21
|
tr
|
21
|
-
th scope="row"
|
22
|
-
a> id='song-#{i+1}' href='./#song-#{i+1}' #{i+1}
|
23
22
|
td
|
24
|
-
|
23
|
+
audio controls=true id='audio-#{i+1}'
|
24
|
+
td=mp3[:title] || mp3[:file]
|
25
25
|
td=mp3[:artist]
|
26
26
|
td=mp3[:album]
|
27
|
+
javascript:
|
28
|
+
function setupHLS(audioElementId, streamUrl) {
|
29
|
+
const audio = document.getElementById(audioElementId);
|
30
|
+
|
31
|
+
if (Hls.isSupported()) {
|
32
|
+
const hls = new Hls();
|
33
|
+
hls.loadSource(streamUrl);
|
34
|
+
hls.attachMedia(audio);
|
35
|
+
hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
36
|
+
console.log(`${audioElementId} loaded`);
|
37
|
+
});
|
38
|
+
} else if (audio.canPlayType('application/vnd.apple.mpegurl')) {
|
39
|
+
// HLS native support browser. ex.Safari
|
40
|
+
audio.src = streamUrl;
|
41
|
+
} else {
|
42
|
+
console.error('This browser cannot play HLS.');
|
43
|
+
}
|
44
|
+
}
|
45
|
+
var mp3s = #{{JSON.generate(mp3_list)}};
|
46
|
+
for (let i = 0; i < mp3s.length; i++) {
|
47
|
+
setupHLS(`audio-${i+1}`, `/stream/${mp3s[i].file}/playlist.m3u8`);
|
48
|
+
}
|
27
49
|
hr
|
28
50
|
p Miniradio ver #{MiniradioServer::VERSION}
|