Skip to content

Amend package:web tweaks to allow package:web roll #6793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/video_player/video_player_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## 2.3.1

* Fixes some `package:web` tweaks.

## 2.3.0

* Migrates package and tests to `package:web``.
* Migrates package and tests to `package:web`.
* Fixes infinite event loop caused by `seekTo` when the video ends.

## 2.2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ import 'package:web/web.dart' as web;
/// Adds a `controlsList` and `disablePictureInPicture` getters.
extension NonStandardGettersOnVideoElement on web.HTMLVideoElement {
external web.DOMTokenList? get controlsList;
external JSBoolean get disablePictureInPicture;
// TODO(srujzs): This will be added in `package:web` 0.6.0. Remove this helper
// once it's available.
external bool get disablePictureInPicture;
}

/// Adds a `disableRemotePlayback` getter.
extension NonStandardGettersOnMediaElement on web.HTMLMediaElement {
external JSBoolean get disableRemotePlayback;
// TODO(srujzs): This will be added in `package:web` 0.6.0. Remove this helper
// once it's available.
external bool get disableRemotePlayback;
}

/// Defines JS interop to access static methods from `Object`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:js_interop';
import 'package:web/web.dart' as web;

/// Adds a "disablePictureInPicture" setter to [web.HTMLVideoElement]s.
extension NonStandardSettersOnVideoElement on web.HTMLVideoElement {
external set disablePictureInPicture(JSBoolean disabled);
// TODO(srujzs): This will be added in `package:web` 0.6.0. Remove this helper
// once it's available.
external set disablePictureInPicture(bool disabled);
}

/// Adds a "disableRemotePlayback" and "controlsList" setters to [web.HTMLMediaElement]s.
extension NonStandardSettersOnMediaElement on web.HTMLMediaElement {
external set disableRemotePlayback(JSBoolean disabled);
external set controlsList(JSString? controlsList);
// TODO(srujzs): This will be added in `package:web` 0.6.0. Remove this helper
// once it's available.
external set disableRemotePlayback(bool disabled);
external set controlsList(String? controlsList);
}
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ class VideoPlayer {
_videoElement.controls = true;
final String controlsList = options.controls.controlsList;
if (controlsList.isNotEmpty) {
_videoElement.controlsList = controlsList.toJS;
_videoElement.controlsList = controlsList;
}

if (!options.controls.allowPictureInPicture) {
_videoElement.disablePictureInPicture = true.toJS;
_videoElement.disablePictureInPicture = true;
}
}

Expand All @@ -254,7 +254,7 @@ class VideoPlayer {
}

if (!options.allowRemotePlayback) {
_videoElement.disableRemotePlayback = true.toJS;
_videoElement.disableRemotePlayback = true;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/video_player/video_player_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.0
version: 2.3.1

environment:
sdk: ^3.3.0
Expand Down