mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-31 07:50:12 +08:00
opt: edl file (#2455)
This commit is contained in:
committed by
GitHub
parent
3a5636ecee
commit
dae8df840a
@@ -717,9 +717,8 @@ class VideoDetailController extends GetxController
|
|||||||
bool autoFullScreenFlag = false,
|
bool autoFullScreenFlag = false,
|
||||||
}) async {
|
}) async {
|
||||||
Duration? seek = defaultST ?? playedTime;
|
Duration? seek = defaultST ?? playedTime;
|
||||||
if (seek == null || seek == Duration.zero) {
|
if (seek == .zero) seek = null;
|
||||||
seek = getFirstSegment();
|
seek ??= getFirstSegment();
|
||||||
}
|
|
||||||
await plPlayerController.setDataSource(
|
await plPlayerController.setDataSource(
|
||||||
isFileSource
|
isFileSource
|
||||||
? FileSource(
|
? FileSource(
|
||||||
@@ -858,36 +857,49 @@ class VideoDetailController extends GetxController
|
|||||||
displayTime: const Duration(seconds: 3),
|
displayTime: const Duration(seconds: 3),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (data.dash == null && data.durl != null) {
|
|
||||||
final first = data.durl!.first;
|
|
||||||
videoUrl = VideoUtils.getCdnUrl(first.playUrls);
|
|
||||||
audioUrl = '';
|
|
||||||
|
|
||||||
// 实际为FLV/MP4格式,但已被淘汰,这里仅做兜底处理
|
|
||||||
final videoQuality = VideoQuality.fromCode(data.quality!);
|
|
||||||
firstVideo = VideoItem(
|
|
||||||
id: data.quality!,
|
|
||||||
baseUrl: videoUrl,
|
|
||||||
codecs: 'avc1',
|
|
||||||
quality: videoQuality,
|
|
||||||
);
|
|
||||||
_setVideoHeight();
|
|
||||||
currentDecodeFormats = VideoDecodeFormatType.AVC;
|
|
||||||
currentVideoQa.value = videoQuality;
|
|
||||||
await _initPlayerIfNeeded(autoFullScreenFlag);
|
|
||||||
isQuerying = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (data.dash == null) {
|
if (data.dash == null) {
|
||||||
SmartDialog.showToast('视频资源不存在');
|
if (data.durl case final durl?) {
|
||||||
_autoPlay.value = false;
|
// it will cause all files to be opened simultaneously
|
||||||
videoState.value = false;
|
if (durl.length > 1) {
|
||||||
if (plPlayerController.isFullScreen.value) {
|
// TODO: refa
|
||||||
plPlayerController.triggerFullScreen(status: false);
|
final sb = StringBuffer('edl://!no_clip;!no_chapters;');
|
||||||
|
for (var i in durl) {
|
||||||
|
final video = VideoUtils.getCdnUrl(i.playUrls);
|
||||||
|
sb.write('%${video.length}%$video,length=${i.length! / 1000};');
|
||||||
|
}
|
||||||
|
videoUrl = sb.toString();
|
||||||
|
} else {
|
||||||
|
videoUrl = VideoUtils.getCdnUrl(durl.single.playUrls);
|
||||||
|
}
|
||||||
|
|
||||||
|
audioUrl = '';
|
||||||
|
|
||||||
|
// 实际为FLV/MP4格式,但已被淘汰,这里仅做兜底处理
|
||||||
|
final videoQuality = VideoQuality.fromCode(data.quality!);
|
||||||
|
firstVideo = VideoItem(
|
||||||
|
id: data.quality!,
|
||||||
|
baseUrl: videoUrl,
|
||||||
|
codecs: 'avc1',
|
||||||
|
quality: videoQuality,
|
||||||
|
);
|
||||||
|
_setVideoHeight();
|
||||||
|
currentDecodeFormats = VideoDecodeFormatType.AVC;
|
||||||
|
currentVideoQa.value = videoQuality;
|
||||||
|
await _initPlayerIfNeeded(autoFullScreenFlag);
|
||||||
|
isQuerying = false;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
SmartDialog.showToast('视频资源不存在');
|
||||||
|
_autoPlay.value = false;
|
||||||
|
videoState.value = false;
|
||||||
|
if (plPlayerController.isFullScreen.value) {
|
||||||
|
plPlayerController.triggerFullScreen(status: false);
|
||||||
|
}
|
||||||
|
isQuerying = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
isQuerying = false;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<VideoItem> videoList = data.dash!.video!;
|
final List<VideoItem> videoList = data.dash!.video!;
|
||||||
// if (kDebugMode) debugPrint("allVideosList:${allVideosList}");
|
// if (kDebugMode) debugPrint("allVideosList:${allVideosList}");
|
||||||
// 当前可播放的最高质量视频
|
// 当前可播放的最高质量视频
|
||||||
|
|||||||
@@ -572,7 +572,17 @@ class HeaderControlState extends State<HeaderControl>
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
plPlayerController.onlyPlayAudio.value =
|
plPlayerController.onlyPlayAudio.value =
|
||||||
!onlyPlayAudio;
|
!onlyPlayAudio;
|
||||||
widget.videoDetailCtr.playerInit();
|
final player =
|
||||||
|
plPlayerController.videoPlayerController!;
|
||||||
|
if (onlyPlayAudio &&
|
||||||
|
player.state.tracks.video.length <= 2) {
|
||||||
|
videoDetailCtr.playerInit();
|
||||||
|
} else {
|
||||||
|
player.setProperty(
|
||||||
|
'file-local-options/vid',
|
||||||
|
onlyPlayAudio ? 'auto' : 'no',
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
text: " 听视频 ",
|
text: " 听视频 ",
|
||||||
selectStatus: onlyPlayAudio,
|
selectStatus: onlyPlayAudio,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'dart:async' show StreamSubscription, Timer;
|
import 'dart:async' show StreamSubscription, Timer;
|
||||||
import 'dart:convert' show ascii;
|
import 'dart:convert' show ascii, utf8;
|
||||||
import 'dart:io' show Platform;
|
import 'dart:io' show Platform;
|
||||||
import 'dart:math' show max, min;
|
import 'dart:math' show max, min;
|
||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
@@ -816,8 +816,15 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
if (onlyPlayAudio.value) {
|
if (onlyPlayAudio.value) {
|
||||||
video = audio;
|
video = audio;
|
||||||
} else {
|
} else {
|
||||||
extras['audio-files'] =
|
// dely_open need provide length
|
||||||
'"${Platform.isWindows ? audio.replaceAll(';', r'\;') : audio.replaceAll(':', r'\:')}"';
|
video =
|
||||||
|
('edl://'
|
||||||
|
'!no_clip;!no_chapters;'
|
||||||
|
// '!delay_open,media_type=video;'
|
||||||
|
'%${isFileSource ? utf8.encode(video).length : video.length}%$video;'
|
||||||
|
'!new_stream;!no_clip;!no_chapters;'
|
||||||
|
// '!delay_open,media_type=audio;'
|
||||||
|
'%${isFileSource ? utf8.encode(audio).length : audio.length}%$audio');
|
||||||
}
|
}
|
||||||
if (enableAudioNormalization) {
|
if (enableAudioNormalization) {
|
||||||
final String audioNormalization;
|
final String audioNormalization;
|
||||||
|
|||||||
Reference in New Issue
Block a user