[GH-ISSUE #1228] Playback randomly fails #702

Closed
opened 2026-02-26 02:34:00 +03:00 by kerem · 2 comments
Owner

Originally created by @neemzy on GitHub (Jun 1, 2020).
Original GitHub issue: https://github.com/koel/koel/issues/1228

Describe the bug
While listening, Koel sometimes randomly skips to the next song (or stops playing if there isn't any). The error seems to be ServiceWorker-related: Unable to load "https://[url]/api/8c84750b0b91259f5b784afe8f3379e3/play?jwt-token=[token]". A ServiceWorker intercepted the request and encountered an unexpected error.. This would corroborate my belief this happens when the song has already been played recently.

To reproduce
Steps to reproduce the behavior:

  1. Play a (preferably long) song
  2. Play it again
  3. Wait a while to see it suddenly skip/stop

Expected behavior
The song plays normally and doesn't skip/stop.

Environment

  • Koel version: v4.3.1 (b1aad4891904d8c52e325c807de72cd8cc2a3bde)
  • OS: macOS Catalina
  • Browser: Firefox 76.0.1
  • PHP version: 7.4.6
  • Node version: 14.2.0

Additional context
My Koel instance is served through Cloudflare (which provides HTTPS). The correct scheme wasn't used by the application so I slightly hacked around it upon installation:

diff --git a/resources/views/client-js-vars.blade.php b/resources/views/client-js-vars.blade.php
index e2501d7..907f2ce 100644
--- a/resources/views/client-js-vars.blade.php
+++ b/resources/views/client-js-vars.blade.php
@@ -3,7 +3,7 @@
         We actually should use a library like dotenv-webpack to load .env variables.
         Unfortunately, can't get it to work for now :(
     --}}
-    window.BASE_URL = "{{ asset('') }}";
+    window.BASE_URL = "{{ asset('') }}".replace('http', 'https');
     window.PUSHER_APP_KEY = "{{ env('PUSHER_APP_KEY') }}";
     window.PUSHER_APP_CLUSTER = "{{ env('PUSHER_APP_CLUSTER') }}";
 </script>

I also rollbacked the frontend submodule (resources/assets) from fa6aefad054ffad3faf84fe85732f04c6ddd742a to b1b17d093aff6c1351e9d1f50c46ed48a45dc277 because Webpack wouldn't correctly build the TypeScript version.

Originally created by @neemzy on GitHub (Jun 1, 2020). Original GitHub issue: https://github.com/koel/koel/issues/1228 **Describe the bug** While listening, Koel sometimes randomly skips to the next song (or stops playing if there isn't any). The error seems to be ServiceWorker-related: `Unable to load "https://[url]/api/8c84750b0b91259f5b784afe8f3379e3/play?jwt-token=[token]". A ServiceWorker intercepted the request and encountered an unexpected error.`. This would corroborate my belief this happens when the song has already been played recently. **To reproduce** Steps to reproduce the behavior: 1. Play a (preferably long) song 2. Play it again 3. Wait a while to see it suddenly skip/stop **Expected behavior** The song plays normally and doesn't skip/stop. **Environment** - Koel version: `v4.3.1` (`b1aad4891904d8c52e325c807de72cd8cc2a3bde`) - OS: macOS Catalina - Browser: Firefox 76.0.1 - PHP version: 7.4.6 - Node version: 14.2.0 **Additional context** My Koel instance is served through Cloudflare (which provides HTTPS). The correct scheme wasn't used by the application so I slightly hacked around it upon installation: ``` diff --git a/resources/views/client-js-vars.blade.php b/resources/views/client-js-vars.blade.php index e2501d7..907f2ce 100644 --- a/resources/views/client-js-vars.blade.php +++ b/resources/views/client-js-vars.blade.php @@ -3,7 +3,7 @@ We actually should use a library like dotenv-webpack to load .env variables. Unfortunately, can't get it to work for now :( --}} - window.BASE_URL = "{{ asset('') }}"; + window.BASE_URL = "{{ asset('') }}".replace('http', 'https'); window.PUSHER_APP_KEY = "{{ env('PUSHER_APP_KEY') }}"; window.PUSHER_APP_CLUSTER = "{{ env('PUSHER_APP_CLUSTER') }}"; </script> ``` I also rollbacked the frontend submodule (`resources/assets`) from `fa6aefad054ffad3faf84fe85732f04c6ddd742a` to `b1b17d093aff6c1351e9d1f50c46ed48a45dc277` because Webpack wouldn't correctly build the TypeScript version.
Author
Owner

@BrookeDot commented on GitHub (Dec 30, 2020):

This is likely caused by the same issue as #1255 where the token expires. I've seen it a few times as well. I'm going to close this as a duplicate (although technically it was reported first) since the other issue has a better description.

<!-- gh-comment-id:752337415 --> @BrookeDot commented on GitHub (Dec 30, 2020): This is likely caused by the same issue as #1255 where the token expires. I've seen it a few times as well. I'm going to close this as a duplicate (although technically it was reported first) since the other issue has a better description.
Author
Owner

@BrookeDot commented on GitHub (Dec 30, 2020):

also related #847

<!-- gh-comment-id:752339097 --> @BrookeDot commented on GitHub (Dec 30, 2020): also related #847
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#702
No description provided.