mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-05 02:00:13 +08:00
configure audio buffer
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -336,6 +336,7 @@ class AudioController extends GetxController
|
|||||||
? (desktopVolume.value * 100).toString()
|
? (desktopVolume.value * 100).toString()
|
||||||
: Pref.playerVolume.toString(),
|
: Pref.playerVolume.toString(),
|
||||||
'volume-max': kMaxVolume.toString(),
|
'volume-max': kMaxVolume.toString(),
|
||||||
|
...Pref.initBuffer(),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -768,7 +768,6 @@ class _AudioPageState extends State<AudioPage> {
|
|||||||
Widget _buildProgressBar(ColorScheme colorScheme) {
|
Widget _buildProgressBar(ColorScheme colorScheme) {
|
||||||
final primary = colorScheme.primary;
|
final primary = colorScheme.primary;
|
||||||
final thumbGlowColor = primary.withAlpha(80);
|
final thumbGlowColor = primary.withAlpha(80);
|
||||||
final bufferedBarColor = primary.withValues(alpha: 0.4);
|
|
||||||
final baseBarColor = colorScheme.isDark
|
final baseBarColor = colorScheme.isDark
|
||||||
? const Color(0x33FFFFFF)
|
? const Color(0x33FFFFFF)
|
||||||
: const Color(0x33999999);
|
: const Color(0x33999999);
|
||||||
@@ -778,7 +777,7 @@ class _AudioPageState extends State<AudioPage> {
|
|||||||
total: _controller.duration.value,
|
total: _controller.duration.value,
|
||||||
baseBarColor: baseBarColor,
|
baseBarColor: baseBarColor,
|
||||||
progressBarColor: primary,
|
progressBarColor: primary,
|
||||||
bufferedBarColor: bufferedBarColor,
|
bufferedBarColor: Colors.transparent,
|
||||||
thumbColor: primary,
|
thumbColor: primary,
|
||||||
thumbGlowColor: thumbGlowColor,
|
thumbGlowColor: thumbGlowColor,
|
||||||
thumbGlowRadius: 0,
|
thumbGlowRadius: 0,
|
||||||
|
|||||||
@@ -621,29 +621,10 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String>? _buffer;
|
Map<String, String>? _buffer;
|
||||||
Map<String, String> get buffer => _buffer ??= _initBuffer();
|
Map<String, String> get buffer =>
|
||||||
|
_buffer ??= Pref.initBuffer(_playbackSpeed.value);
|
||||||
Map<String, String>? _liveBuffer;
|
Map<String, String>? _liveBuffer;
|
||||||
Map<String, String> get liveBuffer => _liveBuffer ??= _initLiveBuffer();
|
Map<String, String> get liveBuffer => _liveBuffer ??= Pref.initLiveBuffer();
|
||||||
|
|
||||||
Map<String, String> _initBuffer() {
|
|
||||||
final bufSec = Pref.bufferSec * _playbackSpeed.value;
|
|
||||||
final bufSiz = (Pref.bufferSize * 0x100000).toStringAsFixed(0);
|
|
||||||
return {
|
|
||||||
'cache': 'yes',
|
|
||||||
'cache-secs': bufSec.toStringAsFixed(3),
|
|
||||||
'demuxer-hysteresis-secs': (bufSec / 1.5).toStringAsFixed(3),
|
|
||||||
'demuxer-max-bytes': bufSiz,
|
|
||||||
'demuxer-max-back-bytes': bufSiz,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, String> _initLiveBuffer() {
|
|
||||||
return {
|
|
||||||
'cache': 'yes',
|
|
||||||
'demuxer-max-bytes': (Pref.bufferSize * 0x200000).toStringAsFixed(0),
|
|
||||||
'demuxer-max-back-bytes': '0',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// 配置播放器
|
// 配置播放器
|
||||||
Future<void> _createVideoController(
|
Future<void> _createVideoController(
|
||||||
|
|||||||
@@ -435,6 +435,26 @@ abstract final class Pref {
|
|||||||
static double get bufferSec =>
|
static double get bufferSec =>
|
||||||
_setting.get(SettingBoxKey.bufferSec, defaultValue: 16.0);
|
_setting.get(SettingBoxKey.bufferSec, defaultValue: 16.0);
|
||||||
|
|
||||||
|
static Map<String, String> initBuffer([double playbackSpeed = 1.0]) {
|
||||||
|
final bufSec = Pref.bufferSec * playbackSpeed;
|
||||||
|
final bufSiz = (Pref.bufferSize * 0x100000).toStringAsFixed(0);
|
||||||
|
return {
|
||||||
|
'cache': 'yes',
|
||||||
|
'cache-secs': bufSec.toStringAsFixed(3),
|
||||||
|
'demuxer-hysteresis-secs': (bufSec / 1.5).toStringAsFixed(3),
|
||||||
|
'demuxer-max-bytes': bufSiz,
|
||||||
|
'demuxer-max-back-bytes': bufSiz,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static Map<String, String> initLiveBuffer() {
|
||||||
|
return {
|
||||||
|
'cache': 'yes',
|
||||||
|
'demuxer-max-bytes': (Pref.bufferSize * 0x200000).toStringAsFixed(0),
|
||||||
|
'demuxer-max-back-bytes': '0',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
static String get audioOutput => _setting.get(
|
static String get audioOutput => _setting.get(
|
||||||
SettingBoxKey.audioOutput,
|
SettingBoxKey.audioOutput,
|
||||||
defaultValue: AudioOutput.defaultValue,
|
defaultValue: AudioOutput.defaultValue,
|
||||||
|
|||||||
Reference in New Issue
Block a user