video: option to disable frame capture
This commit is contained in:
parent
9ad32aa454
commit
f2cb617a7f
3 changed files with 18 additions and 1 deletions
|
@ -85,6 +85,7 @@ class Settings extends ChangeNotifier {
|
||||||
// video
|
// video
|
||||||
static const videoQuickActionsKey = 'video_quick_actions';
|
static const videoQuickActionsKey = 'video_quick_actions';
|
||||||
static const enableVideoHardwareAccelerationKey = 'video_hwaccel_mediacodec';
|
static const enableVideoHardwareAccelerationKey = 'video_hwaccel_mediacodec';
|
||||||
|
static const enableVideoFrameCaptureKey = 'video_enable_snapshot';
|
||||||
static const enableVideoAutoPlayKey = 'video_auto_play';
|
static const enableVideoAutoPlayKey = 'video_auto_play';
|
||||||
static const videoLoopModeKey = 'video_loop';
|
static const videoLoopModeKey = 'video_loop';
|
||||||
static const videoShowRawTimedTextKey = 'video_show_raw_timed_text';
|
static const videoShowRawTimedTextKey = 'video_show_raw_timed_text';
|
||||||
|
@ -362,6 +363,10 @@ class Settings extends ChangeNotifier {
|
||||||
|
|
||||||
set enableVideoHardwareAcceleration(bool newValue) => setAndNotify(enableVideoHardwareAccelerationKey, newValue);
|
set enableVideoHardwareAcceleration(bool newValue) => setAndNotify(enableVideoHardwareAccelerationKey, newValue);
|
||||||
|
|
||||||
|
bool get enableVideoFrameCapture => getBoolOrDefault(enableVideoFrameCaptureKey, true);
|
||||||
|
|
||||||
|
set enableVideoFrameCapture(bool newValue) => setAndNotify(enableVideoFrameCaptureKey, newValue);
|
||||||
|
|
||||||
bool get enableVideoAutoPlay => getBoolOrDefault(enableVideoAutoPlayKey, SettingsDefaults.enableVideoAutoPlay);
|
bool get enableVideoAutoPlay => getBoolOrDefault(enableVideoAutoPlayKey, SettingsDefaults.enableVideoAutoPlay);
|
||||||
|
|
||||||
set enableVideoAutoPlay(bool newValue) => setAndNotify(enableVideoAutoPlayKey, newValue);
|
set enableVideoAutoPlay(bool newValue) => setAndNotify(enableVideoAutoPlayKey, newValue);
|
||||||
|
@ -588,6 +593,7 @@ class Settings extends ChangeNotifier {
|
||||||
case enableOverlayBlurEffectKey:
|
case enableOverlayBlurEffectKey:
|
||||||
case viewerUseCutoutKey:
|
case viewerUseCutoutKey:
|
||||||
case enableVideoHardwareAccelerationKey:
|
case enableVideoHardwareAccelerationKey:
|
||||||
|
case enableVideoFrameCaptureKey:
|
||||||
case enableVideoAutoPlayKey:
|
case enableVideoAutoPlayKey:
|
||||||
case subtitleShowOutlineKey:
|
case subtitleShowOutlineKey:
|
||||||
case saveSearchHistoryKey:
|
case saveSearchHistoryKey:
|
||||||
|
|
|
@ -45,6 +45,15 @@ class VideoSection extends StatelessWidget {
|
||||||
onChanged: (v) => settings.enableVideoHardwareAcceleration = v,
|
onChanged: (v) => settings.enableVideoHardwareAcceleration = v,
|
||||||
title: Text(context.l10n.settingsVideoEnableHardwareAcceleration),
|
title: Text(context.l10n.settingsVideoEnableHardwareAcceleration),
|
||||||
),
|
),
|
||||||
|
Selector<Settings, bool>(
|
||||||
|
selector: (context, s) => s.enableVideoFrameCapture,
|
||||||
|
builder: (context, current, child) => SwitchListTile(
|
||||||
|
value: current,
|
||||||
|
onChanged: (v) => settings.enableVideoFrameCapture = v,
|
||||||
|
// TODO TLAD l10n
|
||||||
|
title: Text('enable frame capture'),
|
||||||
|
),
|
||||||
|
),
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
value: currentEnableVideoAutoPlay,
|
value: currentEnableVideoAutoPlay,
|
||||||
onChanged: (v) => settings.enableVideoAutoPlay = v,
|
onChanged: (v) => settings.enableVideoAutoPlay = v,
|
||||||
|
|
|
@ -25,6 +25,7 @@ class IjkPlayerAvesVideoController extends AvesVideoController {
|
||||||
final List<StreamSummary> _streams = [];
|
final List<StreamSummary> _streams = [];
|
||||||
Timer? _initialPlayTimer;
|
Timer? _initialPlayTimer;
|
||||||
double _speed = 1;
|
double _speed = 1;
|
||||||
|
bool captureFrameEnabled = false;
|
||||||
|
|
||||||
// audio/video get out of sync with speed < .5
|
// audio/video get out of sync with speed < .5
|
||||||
// the video stream plays at .5 but the audio is slowed as requested
|
// the video stream plays at .5 but the audio is slowed as requested
|
||||||
|
@ -53,9 +54,10 @@ class IjkPlayerAvesVideoController extends AvesVideoController {
|
||||||
static const initialPlayDelay = Duration(milliseconds: 100);
|
static const initialPlayDelay = Duration(milliseconds: 100);
|
||||||
static const gifLikeVideoDurationThreshold = Duration(seconds: 10);
|
static const gifLikeVideoDurationThreshold = Duration(seconds: 10);
|
||||||
static const gifLikeBitRateThreshold = 2 << 18; // 512kB/s (4Mb/s)
|
static const gifLikeBitRateThreshold = 2 << 18; // 512kB/s (4Mb/s)
|
||||||
static const captureFrameEnabled = true;
|
|
||||||
|
|
||||||
IjkPlayerAvesVideoController(AvesEntry entry) : super(entry) {
|
IjkPlayerAvesVideoController(AvesEntry entry) : super(entry) {
|
||||||
|
captureFrameEnabled = settings.enableVideoFrameCapture;
|
||||||
|
|
||||||
_instance = FijkPlayer();
|
_instance = FijkPlayer();
|
||||||
_valueStream.map((value) => value.videoRenderStart).firstWhere((v) => v, orElse: () => false).then(
|
_valueStream.map((value) => value.videoRenderStart).firstWhere((v) => v, orElse: () => false).then(
|
||||||
(started) => canCaptureFrameNotifier.value = captureFrameEnabled && started,
|
(started) => canCaptureFrameNotifier.value = captureFrameEnabled && started,
|
||||||
|
|
Loading…
Reference in a new issue