Skip to content
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

VideoPlayerWebOptions is not working #150327

Closed
TheCGDF opened this issue Jun 17, 2024 · 11 comments · Fixed by flutter/packages#6990
Closed

VideoPlayerWebOptions is not working #150327

TheCGDF opened this issue Jun 17, 2024 · 11 comments · Fixed by flutter/packages#6990
Assignees
Labels
found in release: 3.22 Found to occur in 3.22 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: video_player The Video Player plugin P1 High-priority issues at the top of the work list package flutter/packages repository. See also p: labels. platform-web Web applications specifically team-web Owned by Web platform team triaged-web Triaged by Web platform team

Comments

@TheCGDF
Copy link

TheCGDF commented Jun 17, 2024

Steps to reproduce

  1. make a VideoPlayerController with webOptions.
VideoPlayerController.asset("assets/xxx.mp4",
        videoPlayerOptions: VideoPlayerOptions(
            webOptions: const VideoPlayerWebOptions(
                allowContextMenu: false, allowRemotePlayback: false)));
  1. We should have such options on web now:
allowDownload: false,
allowFullscreen: false,
allowPlaybackRate: false,
allowPictureInPicture: false
allowContextMenu: false,
allowRemotePlayback: false

Expected results

Cannot download/fullscreen/... videos

Actual results

Nothing works. Videos can still be downloaded/...

Code sample

Code sample
import 'package:flutter/cupertino.dart';
import 'package:video_player/video_player.dart';
import 'package:video_player_platform_interface/video_player_platform_interface.dart';

class VideoBody extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => VideoBodyState();
}

class VideoBodyState extends State<VideoBody> {
  late VideoPlayerController _backgroundPlayer;

  @override
  void initState() {
    _backgroundPlayer = VideoPlayerController.asset("assets/xxx.mp4",
        videoPlayerOptions: VideoPlayerOptions(
            webOptions: const VideoPlayerWebOptions(
                allowContextMenu: false,
                allowRemotePlayback: false)));
    _backgroundPlayer.setVolume(0);
    _backgroundPlayer.initialize().then((_) => _backgroundPlayer.play());
    super.initState();
  }

  @override
  Widget build(BuildContext context) => VideoPlayer(_backgroundPlayer);
}

Screenshots or Video

Screenshots / Video demonstration

image

image

Logs

Logs
No error.

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.22631.3737], locale en-US)
    • Flutter version 3.22.2 on channel stable at D:\Software\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (11 days ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc3)
    • Android SDK at D:\Software\AndroidSDK
    • Platform android-34, build-tools 35.0.0-rc3
    • Java binary at: D:\Software\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105)
    • All Android licenses accepted.

[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.0)
    • Visual Studio at D:\Software\Microsoft Visual Studio
    • Visual Studio Community 2022 version 17.10.34916.146
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.1)
    • Android Studio at D:\Software\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105)

[√] Connected device (2 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.3737]
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 125.0.2535.92

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
@huycozy huycozy added the in triage Presently being triaged by the triage team label Jun 17, 2024
@huycozy
Copy link
Member

huycozy commented Jun 17, 2024

Thanks for the report. I can reproduce this issue as well. Current package versions: video_player: ^2.8.7, video_player_web: ^2.3.1.

flutter doctor -v
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.1 23B74 darwin-x64, locale en-VN)
    • Flutter version 3.22.2 on channel stable at /Users/huynq/Documents/GitHub/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (31 hours ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode15.3.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /Applications/Android Studio.app/
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.89.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (3 available)
    • iPhone (mobile) • d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e • ios            • iOS 15.8 19H370
    • macOS (desktop) • macos                                    • darwin-x64     • macOS 14.1 23B74 darwin-x64
    • Chrome (web)    • chrome                                   • web-javascript • Google Chrome 125.0.6422.142

[✓] Network resources
    • All expected network resources are available.

• No issues found!

@huycozy huycozy added platform-web Web applications specifically p: video_player The Video Player plugin package flutter/packages repository. See also p: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on fyi-ecosystem For the attention of Ecosystem team team-web Owned by Web platform team found in release: 3.22 Found to occur in 3.22 and removed in triage Presently being triaged by the triage team labels Jun 17, 2024
@stuartmorgan
Copy link
Contributor

The issue here is that flutter/packages#3259 never landed, but we landed the platform interface piece that was split out, so we have options that are defined, but not honored by the implementation package.

(This isn't supposed to happen because we're supposed to have full approval on the main PR first, and also in our more current designs we wouldn't have this options class in the platform interface package at all.)

Reverting the platform interface would be a breaking change. @ditman Any chance you could take over flutter/packages#3259 to get it over the line? If not, we should at least deprecate the options and document that they don't work.

@stuartmorgan stuartmorgan added the triaged-ecosystem Triaged by Ecosystem team label Jun 17, 2024
@ditman
Copy link
Member

ditman commented Jun 17, 2024

Any chance you could take over flutter/packages#3259 to get it over the line? If not, we should at least deprecate the options and document that they don't work.

@stuartmorgan yes, let me assign the PR to myself; I'll try to land it next time I'm gardening the repo! (the week of June 24th)

@flutter-triage-bot flutter-triage-bot bot removed fyi-ecosystem For the attention of Ecosystem team triaged-ecosystem Triaged by Ecosystem team labels Jun 17, 2024
@yjbanov yjbanov added P1 High-priority issues at the top of the work list triaged-web Triaged by Web platform team labels Jun 20, 2024
@TheCGDF
Copy link
Author

TheCGDF commented Jun 28, 2024

@stuartmorgan @ditman Do you have any plan to make this fix work on Edge too? Picture in Picture still exists with Edge. I have not tried Firefox.

@stuartmorgan
Copy link
Contributor

What version of video_player_web do you have in your pubspec.lock file? It looks like we forgot to bump the minimum video_player_web constraint when exposing the option; I missed that in review.

@TheCGDF
Copy link
Author

TheCGDF commented Jun 28, 2024

@stuartmorgan 2.3.1

video_player_web:
    dependency: transitive
    description:
      name: video_player_web
      sha256: ff4d69a6614b03f055397c27a71c9d3ddea2b2a23d71b2ba0164f59ca32b8fe2
      url: "https://pub.dev"
    source: hosted
    version: "2.3.1"

@stuartmorgan
Copy link
Contributor

That version does have support for the new options, so please file a new issue with details for investigation.

@ditman
Copy link
Member

ditman commented Jun 28, 2024

What version of video_player_web do you have in your pubspec.lock file? It looks like we forgot to bump the minimum video_player_web constraint when exposing the option; I missed that in review.

I thought bumping the platform interface would be enough (because the web version wouldn't resolve to an earlier version of the PI)?

@stuartmorgan
Copy link
Contributor

Nope, the current constraints would allow for the following combination:

  • video_player 2.9.0
    • Says VideoPlayerWebOptions works
    • Requires _platform_interface ^6.20 and _web ^2.0.0
  • video_player_platform_interface 6.2.2
    • Includes VideoPlayerWebOptions
  • video_player_web 2.0.18
    • Predates VideoPlayerWebOptions handling; will throw if setWebOptions is called because it will use the platform interface base version. (That should probably have been a no-op)
    • Requires _platform_interface ">=6.1.0 <7.0.0"

This is why almost any feature addition involves bumping the platform implementation constraints when we plumb it to the app-facing package; it will compile without it because it only uses the platform interface for that, but it won't work.

@ditman
Copy link
Member

ditman commented Jun 28, 2024

Yyyikes, I'll prepare a quick update later (in the meantime flutter upgrade should tide people over!)

@TheCGDF
Copy link
Author

TheCGDF commented Jun 29, 2024

That version does have support for the new options, so please file a new issue with details for investigation.

Okay, I created a new issue: #151020

auto-submit bot pushed a commit to flutter/packages that referenced this issue Jun 29, 2024
Updates minimum web implementation version to ensure support for the new `webOptions` exposed in the previous release.

## Issues:

* Described here: flutter/flutter#150327 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
found in release: 3.22 Found to occur in 3.22 has reproducible steps The issue has been confirmed reproducible and is ready to work on p: video_player The Video Player plugin P1 High-priority issues at the top of the work list package flutter/packages repository. See also p: labels. platform-web Web applications specifically team-web Owned by Web platform team triaged-web Triaged by Web platform team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants