mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-14 01:37:07 -07:00
fix: Disable media tunneling by default with the option to enable it (#515)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
3ce0ed6dbc
commit
1942738fe4
16 changed files with 256 additions and 199 deletions
|
|
@ -6,6 +6,7 @@ import 'package:flutter/widgets.dart';
|
|||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'package:fladder/models/items/media_segments_model.dart';
|
||||
import 'package:fladder/models/settings/arguments_model.dart';
|
||||
import 'package:fladder/models/settings/key_combinations.dart';
|
||||
import 'package:fladder/util/bitrate_helper.dart';
|
||||
import 'package:fladder/util/localization_helper.dart';
|
||||
|
|
@ -63,6 +64,7 @@ abstract class VideoPlayerSettingsModel with _$VideoPlayerSettingsModel {
|
|||
@Default(false) bool fillScreen,
|
||||
@Default(true) bool hardwareAccel,
|
||||
@Default(false) bool useLibass,
|
||||
@Default(false) bool enableTunneling,
|
||||
@Default(32) int bufferSize,
|
||||
PlayerOptions? playerOptions,
|
||||
@Default(100) double internalVolume,
|
||||
|
|
@ -82,7 +84,8 @@ abstract class VideoPlayerSettingsModel with _$VideoPlayerSettingsModel {
|
|||
|
||||
factory VideoPlayerSettingsModel.fromJson(Map<String, dynamic> json) => _$VideoPlayerSettingsModelFromJson(json);
|
||||
|
||||
PlayerOptions get wantedPlayer => playerOptions ?? PlayerOptions.platformDefaults;
|
||||
PlayerOptions get wantedPlayer =>
|
||||
leanBackMode ? PlayerOptions.nativePlayer : playerOptions ?? PlayerOptions.platformDefaults;
|
||||
|
||||
Map<VideoHotKeys, KeyCombination> get currentShortcuts =>
|
||||
_defaultVideoHotKeys.map((key, value) => MapEntry(key, hotKeys[key] ?? value));
|
||||
|
|
@ -91,6 +94,7 @@ abstract class VideoPlayerSettingsModel with _$VideoPlayerSettingsModel {
|
|||
|
||||
bool playerSame(VideoPlayerSettingsModel other) {
|
||||
return other.hardwareAccel == hardwareAccel &&
|
||||
other.enableTunneling == enableTunneling &&
|
||||
other.useLibass == useLibass &&
|
||||
other.bufferSize == bufferSize &&
|
||||
other.wantedPlayer == wantedPlayer;
|
||||
|
|
@ -106,6 +110,7 @@ abstract class VideoPlayerSettingsModel with _$VideoPlayerSettingsModel {
|
|||
other.fillScreen == fillScreen &&
|
||||
other.hardwareAccel == hardwareAccel &&
|
||||
other.useLibass == useLibass &&
|
||||
other.enableTunneling == enableTunneling &&
|
||||
other.bufferSize == bufferSize &&
|
||||
other.internalVolume == internalVolume &&
|
||||
other.playerOptions == playerOptions &&
|
||||
|
|
@ -119,6 +124,7 @@ abstract class VideoPlayerSettingsModel with _$VideoPlayerSettingsModel {
|
|||
fillScreen.hashCode ^
|
||||
hardwareAccel.hashCode ^
|
||||
useLibass.hashCode ^
|
||||
enableTunneling.hashCode ^
|
||||
bufferSize.hashCode ^
|
||||
internalVolume.hashCode ^
|
||||
audioDevice.hashCode;
|
||||
|
|
@ -132,14 +138,17 @@ enum PlayerOptions {
|
|||
|
||||
const PlayerOptions();
|
||||
|
||||
static Iterable<PlayerOptions> get available => kIsWeb
|
||||
? {PlayerOptions.libMPV}
|
||||
: switch (defaultTargetPlatform) {
|
||||
TargetPlatform.android => PlayerOptions.values,
|
||||
_ => {PlayerOptions.libMDK, PlayerOptions.libMPV},
|
||||
};
|
||||
static Iterable<PlayerOptions> get available => leanBackMode
|
||||
? {PlayerOptions.nativePlayer, PlayerOptions.libMPV}
|
||||
: kIsWeb
|
||||
? {PlayerOptions.libMPV}
|
||||
: switch (defaultTargetPlatform) {
|
||||
TargetPlatform.android => PlayerOptions.values,
|
||||
_ => {PlayerOptions.libMDK, PlayerOptions.libMPV},
|
||||
};
|
||||
|
||||
static PlayerOptions get platformDefaults {
|
||||
if (leanBackMode) return PlayerOptions.nativePlayer;
|
||||
if (kIsWeb) return PlayerOptions.libMPV;
|
||||
return switch (defaultTargetPlatform) {
|
||||
_ => PlayerOptions.libMPV,
|
||||
|
|
@ -191,8 +200,10 @@ Map<VideoHotKeys, KeyCombination> get _defaultVideoHotKeys => {
|
|||
VideoHotKeys.mute => KeyCombination(key: LogicalKeyboardKey.keyM),
|
||||
VideoHotKeys.volumeUp => KeyCombination(key: LogicalKeyboardKey.arrowUp),
|
||||
VideoHotKeys.volumeDown => KeyCombination(key: LogicalKeyboardKey.arrowDown),
|
||||
VideoHotKeys.speedUp => KeyCombination(key: LogicalKeyboardKey.arrowUp, modifier: LogicalKeyboardKey.controlLeft),
|
||||
VideoHotKeys.speedDown => KeyCombination(key: LogicalKeyboardKey.arrowDown, modifier: LogicalKeyboardKey.controlLeft),
|
||||
VideoHotKeys.speedUp =>
|
||||
KeyCombination(key: LogicalKeyboardKey.arrowUp, modifier: LogicalKeyboardKey.controlLeft),
|
||||
VideoHotKeys.speedDown =>
|
||||
KeyCombination(key: LogicalKeyboardKey.arrowDown, modifier: LogicalKeyboardKey.controlLeft),
|
||||
VideoHotKeys.prevVideo =>
|
||||
KeyCombination(key: LogicalKeyboardKey.keyP, modifier: LogicalKeyboardKey.shiftLeft),
|
||||
VideoHotKeys.nextVideo =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue