diff --git a/src/browser/tests/element/html/media.html b/src/browser/tests/element/html/media.html index e6884543..4eba2e76 100644 --- a/src/browser/tests/element/html/media.html +++ b/src/browser/tests/element/html/media.html @@ -76,21 +76,21 @@ audio.pause(); testing.expectEqual('play,playing,pause', events.join(',')); - // Third play: resume from pause, fires play only (not playing) + // Third play: resume from pause, fires play + playing (verified in Chrome) audio.play(); - testing.expectEqual('play,playing,pause,play', events.join(',')); + testing.expectEqual('play,playing,pause,play,playing', events.join(',')); // Pause again audio.pause(); - testing.expectEqual('play,playing,pause,play,pause', events.join(',')); + testing.expectEqual('play,playing,pause,play,playing,pause', events.join(',')); // Load: resets state, fires emptied audio.load(); - testing.expectEqual('play,playing,pause,play,pause,emptied', events.join(',')); + testing.expectEqual('play,playing,pause,play,playing,pause,emptied', events.join(',')); - // Play after load: fires play + playing again (fresh start) + // Play after load: fires play + playing audio.play(); - testing.expectEqual('play,playing,pause,play,pause,emptied,play,playing', events.join(',')); + testing.expectEqual('play,playing,pause,play,playing,pause,emptied,play,playing', events.join(',')); } diff --git a/src/browser/webapi/element/html/Media.zig b/src/browser/webapi/element/html/Media.zig index ab5be73f..ca9f6088 100644 --- a/src/browser/webapi/element/html/Media.zig +++ b/src/browser/webapi/element/html/Media.zig @@ -61,7 +61,6 @@ _playback_rate: f64 = 1.0, _ready_state: ReadyState = .HAVE_NOTHING, _network_state: NetworkState = .NETWORK_EMPTY, _error: ?*MediaError = null, -_playing: bool = false, pub fn asElement(self: *Media) *Element { return self._proto._proto; @@ -145,10 +144,7 @@ pub fn play(self: *Media, page: *Page) !void { self._network_state = .NETWORK_IDLE; if (was_paused) { try self.dispatchEvent("play", page); - if (!self._playing) { - self._playing = true; - try self.dispatchEvent("playing", page); - } + try self.dispatchEvent("playing", page); } } @@ -161,7 +157,6 @@ pub fn pause(self: *Media, page: *Page) !void { pub fn load(self: *Media, page: *Page) !void { self._paused = true; - self._playing = false; self._current_time = 0; self._ready_state = .HAVE_NOTHING; self._network_state = .NETWORK_LOADING;