Skip to content
Merged
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
28 changes: 15 additions & 13 deletions lib/plugin/pl_player/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,6 @@ class PlPlayerController with BlockConfigMixin {
}
}

final Map<String, String> extras = {};

// 音轨
final String audioUri;
if (isFileSource) {
Expand All @@ -819,7 +817,7 @@ class PlPlayerController with BlockConfigMixin {
} else {
audioUri = '';
}
if (audioUri.isNotEmpty) extras['audio-files'] = '"$audioUri"';
await pp.setProperty('audio-files', audioUri);

_videoController ??= VideoController(
player,
Expand All @@ -832,7 +830,8 @@ class PlPlayerController with BlockConfigMixin {

player.setPlaylistMode(looping);

if (kDebugMode || Platform.isAndroid) {
final Map<String, String>? filters;
if (Platform.isAndroid) {
String audioNormalization = AudioNormalization.getParamFromConfig(
Pref.audioNormalization,
);
Expand All @@ -855,9 +854,11 @@ class PlPlayerController with BlockConfigMixin {
AudioNormalization.getParamFromConfig(Pref.fallbackNormalization),
);
}
if (audioNormalization.isNotEmpty) {
extras['lavfi-complex'] = '"[aid1] $audioNormalization [ao]"';
}
filters = audioNormalization.isEmpty
? null
: {'lavfi-complex': '"[aid1] $audioNormalization [ao]"'};
} else {
filters = null;
}

// if (kDebugMode) debugPrint(filters.toString());
Expand All @@ -881,7 +882,7 @@ class PlPlayerController with BlockConfigMixin {
videoUri,
httpHeaders: dataSource.httpHeaders,
start: seekTo,
extras: extras.isEmpty ? null : extras,
extras: filters,
),
play: false,
);
Expand All @@ -901,22 +902,23 @@ class PlPlayerController with BlockConfigMixin {
SmartDialog.showToast('视频源为空,请重新进入本页面');
return false;
}
String? audioUri;
if (!isLive) {
if (dataSource.audioSource.isNullOrEmpty) {
SmartDialog.showToast('音频源为空');
} else {
audioUri = Platform.isWindows
? dataSource.audioSource!.replaceAll(';', '\\;')
: dataSource.audioSource!.replaceAll(':', '\\:');
await (_videoPlayerController!.platform!).setProperty(
'audio-files',
Platform.isWindows
? dataSource.audioSource!.replaceAll(';', '\\;')
: dataSource.audioSource!.replaceAll(':', '\\:'),
);
}
}
await _videoPlayerController!.open(
Media(
dataSource.videoSource!,
httpHeaders: dataSource.httpHeaders,
start: position,
extras: audioUri == null ? null : {'audio-files': '"$audioUri"'},
),
play: true,
);
Expand Down
Loading