From 88bd5e2e39a43904276affc05b79ee7504b0ce34 Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <127771428+ahmedbilal008@users.noreply.github.com> Date: Fri, 11 Oct 2024 01:37:31 +0500 Subject: [PATCH 01/14] Fixed-unmute-issue-on-web --- .../video_player_web/lib/src/video_player.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/video_player/video_player_web/lib/src/video_player.dart b/packages/video_player/video_player_web/lib/src/video_player.dart index 72f4b7dc155b..7282103f5a4a 100644 --- a/packages/video_player/video_player_web/lib/src/video_player.dart +++ b/packages/video_player/video_player_web/lib/src/video_player.dart @@ -179,8 +179,13 @@ class VideoPlayer { // TODO(ditman): Do we need to expose a "muted" API? // https://github.com/flutter/flutter/issues/60721 - _videoElement.muted = !(volume > 0.0); - _videoElement.volume = volume; + + // If the volume is set to 0.0, only change muted attribute, but don't adjust the volume. + _videoElement.muted = volume == 0.0; + // Set the volume only if it's greater than 0.0. + if (volume > 0.0) { + _videoElement.volume = volume; + } } /// Sets the playback `speed`. From 55118bcb1d4cb14c028d6be706941ba02ef80d58 Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <127771428+ahmedbilal008@users.noreply.github.com> Date: Fri, 11 Oct 2024 02:33:10 +0500 Subject: [PATCH 02/14] Updated the test for video player --- .../example/integration_test/video_player_test.dart | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart index 51199ba79d2b..e0b867485486 100644 --- a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart @@ -40,14 +40,19 @@ void main() { expect(video.playsInline, true, reason: 'Needed by safari iOS'); }); - testWidgets('setVolume', (WidgetTester tester) async { + testWidgets('setVolume', (WidgetTester tester) async { final VideoPlayer player = VideoPlayer(videoElement: video)..initialize(); player.setVolume(0); - - expect(video.volume, isZero, reason: 'Volume should be zero'); + expect(video.muted, isTrue, reason: 'muted attribute should be true'); + //If the volume is set to zero, tapping the unmute button may not restore the audio as expected. + expect(video.volume, greaterThan(0), reason: 'Volume should not be set to zero when muted'); + player.setVolume(0.5); + expect(video.volume, 0.5, reason: 'Volume should be set to 0.5'); + expect(video.muted, isFalse, reason: 'Muted attribute should be false'); + expect(() { player.setVolume(-0.0001); }, throwsAssertionError, reason: 'Volume cannot be < 0'); From c0b83f925470bb7577ec30d38ce001e7896bb3d3 Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <127771428+ahmedbilal008@users.noreply.github.com> Date: Fri, 11 Oct 2024 02:52:05 +0500 Subject: [PATCH 03/14] Formatted test case --- .../example/integration_test/video_player_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart index e0b867485486..2da13b0303a3 100644 --- a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart @@ -40,7 +40,7 @@ void main() { expect(video.playsInline, true, reason: 'Needed by safari iOS'); }); - testWidgets('setVolume', (WidgetTester tester) async { + testWidgets('setVolume', (WidgetTester tester) async { final VideoPlayer player = VideoPlayer(videoElement: video)..initialize(); player.setVolume(0); From b3acfcd45d87c295a9e8ec650f895e6f0e0d4a86 Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <127771428+ahmedbilal008@users.noreply.github.com> Date: Thu, 24 Oct 2024 00:06:58 +0500 Subject: [PATCH 04/14] Indentation issue --- .../example/integration_test/video_player_test.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart index 2da13b0303a3..e11daddb39bb 100644 --- a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart @@ -46,8 +46,9 @@ void main() { player.setVolume(0); expect(video.muted, isTrue, reason: 'muted attribute should be true'); - //If the volume is set to zero, tapping the unmute button may not restore the audio as expected. - expect(video.volume, greaterThan(0), reason: 'Volume should not be set to zero when muted'); + // If the volume is set to zero, tapping the unmute button may not restore the audio as expected. + expect(video.volume, greaterThan(0), + reason: 'Volume should not be set to zero when muted'); player.setVolume(0.5); expect(video.volume, 0.5, reason: 'Volume should be set to 0.5'); From 1a45ce1ac09891dec981ac2deafd4d82ef799fd7 Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <127771428+ahmedbilal008@users.noreply.github.com> Date: Thu, 24 Oct 2024 00:19:44 +0500 Subject: [PATCH 05/14] Indentation_fix --- .../example/integration_test/video_player_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart index e11daddb39bb..639693b65aa4 100644 --- a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart @@ -47,7 +47,7 @@ void main() { expect(video.muted, isTrue, reason: 'muted attribute should be true'); // If the volume is set to zero, tapping the unmute button may not restore the audio as expected. - expect(video.volume, greaterThan(0), + expect(video.volume, greaterThan(0), reason: 'Volume should not be set to zero when muted'); player.setVolume(0.5); From 5e5baa6291119579a6e4b96fb8ad01ee2926fd02 Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <127771428+ahmedbilal008@users.noreply.github.com> Date: Thu, 24 Oct 2024 18:19:31 +0500 Subject: [PATCH 06/14] Update pubspec.yaml --- packages/video_player/video_player_web/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/video_player/video_player_web/pubspec.yaml b/packages/video_player/video_player_web/pubspec.yaml index 8c51d65859d5..0985ee1297b5 100644 --- a/packages/video_player/video_player_web/pubspec.yaml +++ b/packages/video_player/video_player_web/pubspec.yaml @@ -2,7 +2,7 @@ name: video_player_web description: Web platform implementation of video_player. repository: https://github.com/flutter/packages/tree/main/packages/video_player/video_player_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22 -version: 2.3.2 +version: 2.3.3 environment: sdk: ^3.4.0 From 303457471a491d11aac9f1b55420267cedf7a5d7 Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <127771428+ahmedbilal008@users.noreply.github.com> Date: Thu, 24 Oct 2024 18:22:13 +0500 Subject: [PATCH 07/14] Update CHANGELOG.md --- packages/video_player/video_player_web/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/video_player/video_player_web/CHANGELOG.md b/packages/video_player/video_player_web/CHANGELOG.md index 39ffe350ed2d..4f805bbef4c9 100644 --- a/packages/video_player/video_player_web/CHANGELOG.md +++ b/packages/video_player/video_player_web/CHANGELOG.md @@ -2,6 +2,10 @@ * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. +## 2.3.3 + +* Corrects the behavior of muting/unmuting videos in Chrome's Tap Emulation mode. + ## 2.3.2 * Adds support for `web: ^1.0.0`. From bca228aea3fd06a483715a832dc310ecbd05411e Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <127771428+ahmedbilal008@users.noreply.github.com> Date: Thu, 24 Oct 2024 18:42:15 +0500 Subject: [PATCH 08/14] Update video_player_test.dart --- .../example/integration_test/video_player_test.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart index 639693b65aa4..19cc2d1c7dc7 100644 --- a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart @@ -44,12 +44,10 @@ void main() { final VideoPlayer player = VideoPlayer(videoElement: video)..initialize(); player.setVolume(0); - expect(video.muted, isTrue, reason: 'muted attribute should be true'); // If the volume is set to zero, tapping the unmute button may not restore the audio as expected. expect(video.volume, greaterThan(0), reason: 'Volume should not be set to zero when muted'); - player.setVolume(0.5); expect(video.volume, 0.5, reason: 'Volume should be set to 0.5'); expect(video.muted, isFalse, reason: 'Muted attribute should be false'); From 9412ac2eda6fe82bbb30f82c0667b898d1651955 Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <127771428+ahmedbilal008@users.noreply.github.com> Date: Thu, 24 Oct 2024 18:49:49 +0500 Subject: [PATCH 09/14] Update CHANGELOG.md --- packages/video_player/video_player_web/CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/video_player/video_player_web/CHANGELOG.md b/packages/video_player/video_player_web/CHANGELOG.md index 4f805bbef4c9..ac788884dbd8 100644 --- a/packages/video_player/video_player_web/CHANGELOG.md +++ b/packages/video_player/video_player_web/CHANGELOG.md @@ -1,9 +1,6 @@ ## NEXT * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. - -## 2.3.3 - * Corrects the behavior of muting/unmuting videos in Chrome's Tap Emulation mode. ## 2.3.2 From 4db076b2508450a19755828fae25e1d14ae47480 Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <127771428+ahmedbilal008@users.noreply.github.com> Date: Thu, 24 Oct 2024 18:57:54 +0500 Subject: [PATCH 10/14] Update CHANGELOG.md --- packages/video_player/video_player_web/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/video_player/video_player_web/CHANGELOG.md b/packages/video_player/video_player_web/CHANGELOG.md index ac788884dbd8..20635077c16c 100644 --- a/packages/video_player/video_player_web/CHANGELOG.md +++ b/packages/video_player/video_player_web/CHANGELOG.md @@ -1,4 +1,4 @@ -## NEXT +## 2.3.3 * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. * Corrects the behavior of muting/unmuting videos in Chrome's Tap Emulation mode. From 75249a25b13fae4c7a43567e00a73ed0a108324c Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <127771428+ahmedbilal008@users.noreply.github.com> Date: Thu, 24 Oct 2024 19:11:12 +0500 Subject: [PATCH 11/14] Update video_player_test.dart --- .../example/integration_test/video_player_test.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart index 19cc2d1c7dc7..2597e5702812 100644 --- a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart @@ -48,6 +48,7 @@ void main() { // If the volume is set to zero, tapping the unmute button may not restore the audio as expected. expect(video.volume, greaterThan(0), reason: 'Volume should not be set to zero when muted'); + player.setVolume(0.5); expect(video.volume, 0.5, reason: 'Volume should be set to 0.5'); expect(video.muted, isFalse, reason: 'Muted attribute should be false'); From f76c96c93b591f5e89d34d19e3ffdc062ff7c9c4 Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <127771428+ahmedbilal008@users.noreply.github.com> Date: Thu, 24 Oct 2024 19:26:50 +0500 Subject: [PATCH 12/14] Update video_player_test.dart --- .../example/integration_test/video_player_test.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart index 2597e5702812..845293decfa3 100644 --- a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart @@ -45,10 +45,9 @@ void main() { player.setVolume(0); expect(video.muted, isTrue, reason: 'muted attribute should be true'); - // If the volume is set to zero, tapping the unmute button may not restore the audio as expected. + // If the volume is set to zero, pressing unmute button may not restore the audio as expected. expect(video.volume, greaterThan(0), reason: 'Volume should not be set to zero when muted'); - player.setVolume(0.5); expect(video.volume, 0.5, reason: 'Volume should be set to 0.5'); expect(video.muted, isFalse, reason: 'Muted attribute should be false'); From eb6975ba1ebf11264dd4fb9c1be90a04c8d3936a Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <127771428+ahmedbilal008@users.noreply.github.com> Date: Thu, 24 Oct 2024 22:02:42 +0500 Subject: [PATCH 13/14] Update video_player_test.dart --- .../example/integration_test/video_player_test.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart index 845293decfa3..7607239a009c 100644 --- a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart @@ -45,9 +45,10 @@ void main() { player.setVolume(0); expect(video.muted, isTrue, reason: 'muted attribute should be true'); - // If the volume is set to zero, pressing unmute button may not restore the audio as expected. + // If the volume is set to zero, pressing unmute + // button may not restore the audio as expected. expect(video.volume, greaterThan(0), - reason: 'Volume should not be set to zero when muted'); + reason: 'Volume should not be set to zero when muted'); player.setVolume(0.5); expect(video.volume, 0.5, reason: 'Volume should be set to 0.5'); expect(video.muted, isFalse, reason: 'Muted attribute should be false'); From 2ff933a6e7075e9828c9dc274fec6b1e7aa99c23 Mon Sep 17 00:00:00 2001 From: Ahmed Bilal <127771428+ahmedbilal008@users.noreply.github.com> Date: Thu, 24 Oct 2024 22:42:44 +0500 Subject: [PATCH 14/14] Update video_player_test.dart --- .../example/integration_test/video_player_test.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart index 7607239a009c..b78de966fe81 100644 --- a/packages/video_player/video_player_web/example/integration_test/video_player_test.dart +++ b/packages/video_player/video_player_web/example/integration_test/video_player_test.dart @@ -48,11 +48,11 @@ void main() { // If the volume is set to zero, pressing unmute // button may not restore the audio as expected. expect(video.volume, greaterThan(0), - reason: 'Volume should not be set to zero when muted'); + reason: 'Volume should not be set to zero when muted'); player.setVolume(0.5); expect(video.volume, 0.5, reason: 'Volume should be set to 0.5'); expect(video.muted, isFalse, reason: 'Muted attribute should be false'); - + expect(() { player.setVolume(-0.0001); }, throwsAssertionError, reason: 'Volume cannot be < 0');