From 2e0134259d9db9eed5d9630efbf5eb59db51d815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20Thomas?= Date: Thu, 6 Jun 2019 22:46:44 +0200 Subject: [PATCH] Try to show a progress bar in the media player This commit is kind of a hack to force MediaElement.js to show a progress bar when we are loading a song. Normally, in vanilla HTML5 MediaElement, we'd explicitely call 'play()' when loading a song. Here, we cannot ensure playback will work well if we don't wait for the 'canplay' event to be fired, but the progress bar won't show up without 'play()'... This commit emits a fake 'waiting' event to let the MEJS know that it should update the UI. --- airsonic-main/src/main/webapp/WEB-INF/jsp/playQueue.jsp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/airsonic-main/src/main/webapp/WEB-INF/jsp/playQueue.jsp b/airsonic-main/src/main/webapp/WEB-INF/jsp/playQueue.jsp index 8426f588..81c8137a 100644 --- a/airsonic-main/src/main/webapp/WEB-INF/jsp/playQueue.jsp +++ b/airsonic-main/src/main/webapp/WEB-INF/jsp/playQueue.jsp @@ -577,6 +577,12 @@ // the 'createMediaElementPlayer()' function above. // // player.play(); + + // FIXME: Remove once https://github.com/mediaelement/mediaelement/issues/2650 is fixed. + // + // Instead, we're triggering a 'waiting' event so that the player shows + // a progress bar to indicate that it's loading the stream. + player.dispatchEvent(new Event("waiting")); } function skip(index, position) {