diff options
| author | RblSb <msrblsb@gmail.com> | 2025-09-10 16:22:00 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2025-09-10 16:22:00 +0300 |
| commit | d4fb50df4f77cb8d039eaecdc8f6467c5fef4d22 (patch) | |
| tree | 04fe87f6574f36cafa038bd24e715b0f0e57132a /src/client/players/Youtube.hx | |
| parent | 9ec382facd8d7813716a10e5f7db3ca7f4ba0259 (diff) | |
Rework isLoad player state
closes #67
Diffstat (limited to 'src/client/players/Youtube.hx')
| -rw-r--r-- | src/client/players/Youtube.hx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/client/players/Youtube.hx b/src/client/players/Youtube.hx index 14eb3c2..678c34a 100644 --- a/src/client/players/Youtube.hx +++ b/src/client/players/Youtube.hx @@ -212,9 +212,11 @@ class Youtube implements IPlayer { return; } if (youtube != null) { + isLoaded = false; youtube.loadVideoById({ videoId: extractVideoId(item.url) }); + if (main.lastState.paused) youtube.pauseVideo(); return; } isLoaded = false; @@ -234,8 +236,8 @@ class Youtube implements IPlayer { events: { onReady: e -> { if (!main.isAutoplayAllowed()) e.target.mute(); - isLoaded = true; if (main.lastState.paused) youtube.pauseVideo(); + isLoaded = true; player.onCanBePlayed(); }, onStateChange: e -> { @@ -243,8 +245,16 @@ class Youtube implements IPlayer { case UNSTARTED: case ENDED: case PLAYING: + if (!isLoaded) { + isLoaded = true; + player.onCanBePlayed(); + } player.onPlay(); case PAUSED: + if (!isLoaded) { + isLoaded = true; + player.onCanBePlayed(); + } player.onPause(); case BUFFERING: player.onSetTime(); |
