Skip to content

VideoPlayerWebOptions is not working #150327

Closed
flutter/packages
#6990
@TheCGDF

Description

@TheCGDF

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.

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listfound in release: 3.22Found to occur in 3.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: video_playerThe Video Player pluginpackageflutter/packages repository. See also p: labels.platform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions