tweak default cfg; use audio element instead of video

This commit is contained in:
Laptop
2024-08-22 13:32:44 +03:00
parent c348ac4cf4
commit 4f33b7bbda
2 changed files with 9 additions and 9 deletions

View File

@@ -8,7 +8,7 @@ import (
// time-to-live for clientid cache
// larger number will improve performance (no need to recheck everytime) but might make soundcloak unusable after soundcloud updates the website
const ClientIDTTL = 5 * time.Minute
const ClientIDTTL = 30 * time.Minute
// time-to-live for user profile cache
const UserTTL = 5 * time.Minute
@@ -17,6 +17,6 @@ const UserTTL = 5 * time.Minute
const TrackTTL = 5 * time.Minute
// default fasthttp one was causing connections to be stuck? todo make it cycle browser useragents or just choose random at startup
const UserAgent = "insomnia/2023.2.0"
const UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0"
var JSON = jsoniter.ConfigFastest

View File

@@ -7,17 +7,17 @@ templ Track(t sc.Track, stream string) {
<h1>{t.Title}</h1>
<video id="track" data-stream={stream} controls style="width: 50rem; height: 2.5rem;"></video>
<audio id="track" data-stream={stream} controls></audio>
<script>
var video = document.getElementById('track');
var videoSrc = video.getAttribute('data-stream');
if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = videoSrc;
var audio = document.getElementById('track');
var audioSrc = audio.getAttribute('data-stream');
if (audio.canPlayType('application/vnd.apple.mpegurl')) {
audio.src = audioSrc;
} else if (Hls.isSupported()) {
var hls = new Hls();
hls.loadSource(videoSrc);
hls.attachMedia(video);
hls.loadSource(audioSrc);
hls.attachMedia(audio);
} else {
alert('hls not supported');
}