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

Introduce onMute and onUnmute methods for player mute detection #258

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 4 additions & 2 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
import FlutterMacOS
import Foundation

import package_info_plus
import path_provider_foundation
import video_player_avfoundation
import wakelock_macos
import wakelock_plus

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin"))
WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin"))
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
}
15 changes: 8 additions & 7 deletions lib/src/flick_video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flick_video_player/flick_video_player.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:wakelock/wakelock.dart';
import 'package:wakelock_plus/wakelock_plus.dart';

class FlickVideoPlayer extends StatefulWidget {
const FlickVideoPlayer({
Expand Down Expand Up @@ -86,7 +86,7 @@ class _FlickVideoPlayerState extends State<FlickVideoPlayer>
_setPreferredOrientation();

if (widget.wakelockEnabled) {
Wakelock.enable();
WakelockPlus.toggle(enable: true);
}

if (kIsWeb) {
Expand All @@ -102,7 +102,7 @@ class _FlickVideoPlayerState extends State<FlickVideoPlayer>
void dispose() {
flickManager.flickControlManager!.removeListener(listener);
if (widget.wakelockEnabled) {
Wakelock.disable();
WakelockPlus.toggle(enable: false);
}
WidgetsBinding.instance.removeObserver(this);
super.dispose();
Expand Down Expand Up @@ -131,8 +131,9 @@ class _FlickVideoPlayerState extends State<FlickVideoPlayer>
_switchToFullscreen() {
if (widget.wakelockEnabledFullscreen) {
/// Disable previous wakelock setting.
Wakelock.disable();
Wakelock.enable();
WakelockPlus.toggle(enable: false);

WakelockPlus.toggle(enable: true);
}

_isFullscreen = true;
Expand Down Expand Up @@ -163,8 +164,8 @@ class _FlickVideoPlayerState extends State<FlickVideoPlayer>
_exitFullscreen() {
if (widget.wakelockEnabled) {
/// Disable previous wakelock setting.
Wakelock.disable();
Wakelock.enable();
WakelockPlus.toggle(enable: false);
WakelockPlus.toggle(enable: true);
}

_isFullscreen = false;
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ dependencies:
sdk: flutter
video_player: ^2.8.1
provider: ^6.1.1
wakelock: ^0.6.2
package_info_plus: ^5.0.1
wakelock_plus: ^1.1.4
universal_html: ^2.2.4
dio: ^5.4.0
path_provider: ^2.1.1
Expand Down