Closed yemin82 closed 2 months ago
前面有字打错了,就是不用抛异常或事件通知
试下master分支,会有错误事件产生
已经可以收到通知了,但是收到8次一样的通知,我不知道是不是遇到这个错误mdk重试了8次,这样就不好处理了,如果遇到一个通知的时候我就处理那么,浪费了mdk的7次重试次数,如果我等8次再处理,那么可能有的异常只重试了3次,结果苦苦等待也等等不来8次,是否可以在重试的最后一次再事件通知
你发下日志,我这边正常
flutter: fvp.FINE: 10:30:45.763: 416399550 player4662066752 create(https://yundunm3.czys.art:88/vtt/gc02/sifangguan/sifangguan01.m3u8) flutter: mdk.FINE: 10:30:45.788: default 0x115ea62e0 new FrameReader... flutter: mdk.FINE: 10:30:45.788: Registered audio backends: AudioQueue OpenAL null flutter: mdk.FINE: 10:30:45.788: default 0x115ea6980 new FrameReader... flutter: mdk.FINE: 10:30:45.789: Registered audio backends: AudioQueue OpenAL null flutter: mdk.FINE: 10:30:45.789: 0x115e674c0 player.Player() flutter: mdk.FINE: 10:30:45.789: 0x115e674c0 player.onEvent(1, 0x70000336dfc0) flutter: mdk.FINE: 10:30:45.789: 0x115e674c0 player.onStateChanged(1) flutter: mdk.FINE: 10:30:45.790: 0x115e674c0 player.onMediaStatus(1) flutter: mdk.FINE: 10:30:45.790: 0x115e674c0 player property: video.decoder = shader_resource=0 flutter: mdk.FINE: 10:30:45.791: 0x115e674c0 player property: avformat.strict = experimental flutter: mdk.FINE: 10:30:45.791: 0x115e674c0 player property: avio.reconnect = 1 flutter: mdk.FINE: 10:30:45.792: 0x115e674c0 player property: avio.reconnect_delay_max = 7 flutter: mdk.FINE: 10:30:45.792: 0x115e674c0 player property: avio.protocol_whitelist = file,rtmp,http,https,tls,rtp,tcp,udp,crypto,httpproxy,data,concatf,concat,subfile flutter: mdk.FINE: 10:30:45.792: 0x115e674c0 player property: avformat.rtsptransport = tcp flutter: mdk.FINE: 10:30:45.793: 0x115e674c0 player.setDecoders(video, [videotoolbox, FFmpeg, VT]) flutter: mdk.FINE: 10:30:45.793: video decoders: "videotoolbox", "FFmpeg", "VT" flutter: mdk.FINE: 10:30:45.793: video decoders: "videotoolbox", "FFmpeg", "VT" flutter: mdk.FINE: 10:30:45.794: 0x115e674c0 player.setMedia(https://yundunm3.czys.art:88/vtt/gc02/sifangguan/sifangguan01.m3u8) flutter: mdk.FINE: 10:30:45.794: default FrameReader0x115ea62e0 state: 0=>0=>0, 0 flutter: mdk.INFO: 10:30:45.794: default0x115ea62e0 stop, current state: 0requested: 1 flutter: mdk.FINE: 10:30:45.794: AudioQueueStart ERROR: 0 flutter: mdk.FINE: 10:30:45.795: default FrameReader0x115ea62e0 state: 0=>0=>0, 0 flutter: mdk.INFO: 10:30:45.795: default0x115ea62e0 stop, current state: 0requested: 1 flutter: mdk.FINE: 10:30:45.795: 0x115e674c0 player.prepare(0, ..., 1282) flutter: mdk.FINE: 10:30:45.795: AudioQueueStart ERROR: 0 flutter: mdk.INFO: 10:30:45.795: 0x116867600 MediaControl.prepare(0, ...) https://yundunm3.czys.art:88/vtt/gc02/sifangguan/sifangguan01.m3u8 flutter: mdk.FINE: 10:30:45.796: default 0x115ea62e0 FrameReader.start(0, ...) flutter: mdk.FINE: 10:30:45.796: default 0x115ea62e0 FrameReader::update MediaStatus 0=>0X2 flutter: fvp.FINE: 10:30:45.798: 130332829 player4662066752 onMediaStatus: MediaStatus(noMedia) => MediaStatus(+loading) flutter: mdk.FINE: 10:30:45.799: default FrameReader0x115ea62e0 state: 0=>0=>1, 0 flutter: mdk.FINE: 10:30:45.800: default FrameReader0x115ea62e0 state: 0=>1=>1, 0 flutter: mdk.FINE: 10:30:45.800: default FrameReader0x115ea62e0 request to pause 1, loaded: 0. flutter: mdk.FINE: 10:30:45.800: default FrameReader0x115ea62e0 state: 0=>1=>2, 0 flutter: mdk.FINE: 10:30:45.800: default FrameReader0x115ea62e0 state requested: 2, current: 0 flutter: mdk.FINE: 10:30:45.801: virtual void mdk::AudioBackendAudioQueue::pause(bool)0x115ea62e0138 ERROR>>> AudioQueuePause(queue): start frame reader thread: -50 flutter: mdk.FINE: 10:30:45.801: flutter: mdk.FINE: 10:30:45.801: 0x70000473e000 flutter: mdk.WARNING: 10:30:45.801: Failed to create io for url. io: 0x0, open: 0 flutter: mdk.FINE: 10:30:45.801: default 0x115ea62e0 FrameReader::update MediaStatus 0X2=>0X2 flutter: mdk.FINE: 10:30:45.802: before avformat_open_input. io: 0x0()/pb: 0x0, url: https://yundunm3.czys.art:88/vtt/gc02/sifangguan/sifangguan01.m3u8 flutter: mdk.FINE: 10:30:46.013: [FFmpeg:hls] Skip ('#EXT-X-VERSION:3') flutter: mdk.FINE: 10:30:46.014: [FFmpeg:hls] Skip ('#EXT-X-ALLOW-CACHE:YES') flutter: mdk.FINE: 10:30:46.067: [FFmpeg:hls] Opening 'https://mdn.alipayobjects.com/open_content/afts/img/A*ibbTQZGTzsoAAAAAAAAAAAAAcFx1AQ/original' for reading flutter: mdk.FINE: 10:30:46.416: [FFmpeg:hls] Opening 'https://mdn.alipayobjects.com/open_content/afts/img/A*nViNQIh0GrgAAAAAAAAAAAAAcFx1AQ/original' for reading flutter: mdk.FINE: 10:30:46.703: after avformat_open_input. pb: 0x115994740, iformat: 0x1111ce0d8, context flags: 2097152, input format flags: 49664 flutter: mdk.FINE: 10:30:46.704: [FFmpeg:hls] Could not find codec parameters for stream 0 (Video: png, none): unspecified size flutter: Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options flutter: mdk.FINE: 10:30:46.704: unsupported avformat options: rtsp_transport=tcp flutter: mdk.INFO: 10:30:46.704: Format: hls, range: 0 +2753520ms, bitrate: 298, size: 0 flutter: Programs: flutter: Program id 0 flutter: Metadata: flutter: variant_bitrate: 0 flutter: Video: flutter: track 0 stream#0, range: 0 +2753520ms, frames: 0 flutter: codec: png tag: 0 profile: -99 level: -99, unknown, bpc:0, bpp:0(), channels:(), map: 0 0 0 0, bitrate: 0, 0x0, fps: 25, bframes: 0 flutter: Metadata: flutter: variantbitrate: 0 flutter: flutter: mdk.FINE: 10:30:46.707: 0x116867600 prepared callback is invoked flutter: mdk.FINE: 10:30:46.708: default 0x115ea62e0 FrameReader::update MediaStatus 0X2=>0X4 flutter: fvp.FINE: 10:30:46.719: 130332829 player4662066752 onMediaStatus: MediaStatus(+loading) => MediaStatus(+loaded) flutter: mdk.INFO: 10:30:46.720: 0x115ea62e0 buffering progress 0% flutter: mdk.FINE: 10:30:46.720: default 0x115ea62e0 FrameReader::update MediaStatus 0X4=>0X14 flutter: mdk.FINE: 10:30:46.721: virtual void mdk::AudioBackendAudioQueue::pause(bool)138 ERROR>>> AudioQueuePause(queue): -50 flutter: mdk.FINE: 10:30:46.721: flutter: fvp.FINE: 10:30:46.721: 130332829 player4662066752 onMediaStatus: MediaStatus(+loaded) => MediaStatus(+loaded+buffering) flutter: mdk.INFO: 10:30:46.722: ++++++++++++BUFFERING START++++++++++++ flutter: mdk.FINE: 10:30:46.722: flutter: fvp.FINE: 10:30:46.723: 130332829 player4662066752 onEvent: reader.buffering - - 0 flutter: mdk.FINE: 10:30:46.725: default 0x115ea62e0 FrameReader::update MediaStatus 0X14=>0X54 flutter: fvp.FINE: 10:30:46.725: 130332829 player4662066752 onMediaStatus: MediaStatus(+loaded+buffering) => MediaStatus(+loaded+buffering+end) flutter: mdk.FINE: 10:30:46.725: read packet error. FrameReader@0x115ea62e0 sending Packet::End to all packet queues. PacketIO@0x115cda8b0 ->url: https://yundunm3.czys.art:88/vtt/gc02/sifangguan/sifangguan01.m3u8 flutter: mdk.FINE: 10:30:46.725: default FrameReader0x115ea62e0 state: 0=>2=>1, 1 flutter: mdk.FINE: 10:30:46.726: default FrameReader0x115ea62e0 update state: 0=>1 flutter: fvp.FINE: 10:30:46.726: 130332829 player4662066752 onPlaybackStateChanged: PlaybackState.stopped => PlaybackState.playing flutter: mdk.FINE: 10:30:46.726: default FrameReader0x115ea62e0 state: 1=>1=>2, 1 flutter: mdk.FINE: 10:30:46.727: default FrameReader0x115ea62e0 update state: 1=>2 flutter: fvp.FINE: 10:30:46.727: 130332829 player4662066752 onPlaybackStateChanged: PlaybackState.playing => PlaybackState.paused flutter: mdk.FINE: 10:30:46.727: before changed() 54 flutter: mdk.FINE: 10:30:46.727: default FrameReader0x115ea62e0 state: 2=>2=>0, 0 flutter: mdk.FINE: 10:30:46.728: 0x115ea62e0 unload, current status 0x54, invalid: 0, loading: 0, loaded: 4, buffering: 16, seeking: 0, prepared: 0, EOF: 64 flutter: mdk.FINE: 10:30:46.728: 0x600003d425d0 request avformat input interrupt flutter: mdk.INFO: 10:30:46.728: 0x115ea62e0 buffering progress 100% flutter: mdk.FINE: 10:30:46.728: default 0x115ea62e0 FrameReader::update MediaStatus 0X54=>0X164 flutter: mdk.FINE: 10:30:46.729: virtual void mdk::AudioBackendAudioQueue::pause(bool)138 ERROR>>> AudioQueuePause(queue_): -50 flutter: mdk.FINE: 10:30:46.729: flutter: fvp.FINE: 10:30:46.729: 130332829 player4662066752 onMediaStatus: MediaStatus(+loaded+buffering+end) => MediaStatus(+loaded+prepared+buffered+end) flutter: mdk.INFO: 10:30:46.729: ++++++++++++BUFFERING END++++++++++++ flutter: mdk.FINE: 10:30:46.730: flutter: fvp.FINE: 10:30:46.730: 130332829 player4662066752 onEvent: reader.buffering - - 100 flutter: mdk.FINE: 10:30:46.730: interrupted by user flutter: mdk.FINE: 10:30:46.730: interrupted by user flutter: mdk.FINE: 10:30:46.730: interrupted by user flutter: mdk.FINE: 10:30:46.731: 0x70000473e000default 0x115ea62e0 update @1147: reset status_mask. status: 161 flutter: mdk.FINE: 10:30:46.731: default 0x115ea62e0 FrameReader::update MediaStatus 0X164=>0X41 flutter: fvp.FINE: 10:30:46.731: 130332829 player4662066752 onMediaStatus: MediaStatus(+loaded+prepared+buffered+end) => MediaStatus(+unloaded+end) flutter: invalid or unsupported media flutter: mdk.FINE: 10:30:46.745: default FrameReader0x115ea62e0 state: 2=>0=>0, 1 flutter: mdk.FINE: 10:30:46.746: default FrameReader0x115ea62e0 update state: 2=>0 flutter: fvp.FINE: 10:30:46.746: 130332829 player4662066752 onPlaybackStateChanged: PlaybackState.paused => PlaybackState.stopped flutter: invalid or unsupported media flutter: mdk.FINE: 10:30:46.746: read thread finished: mdk.read@0x70000473e000 flutter: mdk.FINE: 10:30:46.759: 0x115e674c0 player.set(1) flutter: mdk.FINE: 10:30:46.760: 0x116867600 virtual void mdk::MediaControlPush::setState(PlaybackState)@1068 requested state 2=>1, current state 0. status: 0X41 flutter: mdk.FINE: 10:30:46.760: AudioQueueStart ERROR: 0 flutter: mdk.FINE: 10:30:46.760: AudioQueueStart ERROR: 0 flutter: mdk.FINE: 10:30:46.760: default 0x115ea62e0 FrameReader.start(0, ...) flutter: mdk.FINE: 10:30:46.761: default 0x115ea62e0 FrameReader::update MediaStatus 0X41=>0X2 flutter: fvp.FINE: 10:30:46.761: 130332829 player4662066752 onMediaStatus: MediaStatus(+unloaded+end) => MediaStatus(+loading) flutter: mdk.FINE: 10:30:46.761: default FrameReader0x115ea62e0 state: 0=>0=>1, 0 flutter: mdk.FINE: 10:30:46.761: default FrameReader0x115ea62e0 state: 0=>1=>1, 0 flutter: mdk.FINE: 10:30:46.762: 0x115ea62e0start frame reader thread: 0x70000473e000 flutter: mdk.WARNING: 10:30:46.762: Failed to create io for url. io: 0x0, open: 0 flutter: mdk.FINE: 10:30:46.762: default 0x115ea62e0 FrameReader::update MediaStatus 0X2=>0X2 flutter: mdk.FINE: 10:30:46.762: before avformat_open_input. io: 0x0()/pb: 0x0, url: https://yundunm3.czys.art:88/vtt/gc02/sifangguan/sifangguan01.m3u8 flutter: mdk.FINE: 10:30:46.763: 0x115e674c0 player.setLoop(0) flutter: mdk.INFO: 10:30:46.763: setLoop(0), now 0/0 flutter: mdk.FINE: 10:30:46.763: 0x115e674c0 player.setVolume(1.000000, -1) flutter: mdk.FINE: 10:30:46.763: 0x115e674c0 player.set(1) flutter: mdk.FINE: 10:30:46.764: 0x116867600 virtual void mdk::MediaControlPush::setState(PlaybackState)@1068 requested state 1=>1, current state 0. status: 0X2 flutter: mdk.FINE: 10:30:46.764: AudioQueueStart ERROR: 0 flutter: mdk.FINE: 10:30:46.764: default FrameReader0x115ea62e0 request to pause 0, loaded: 0. flutter: mdk.FINE: 10:30:46.764: default FrameReader0x115ea62e0 state: 0=>1=>1, 0 flutter: mdk.FINE: 10:30:46.764: 0x115e674c0 player.setPlaybackRate(1.000000) flutter: mdk.FINE: 10:30:46.765: 0x115e674c0 player.seek(60000, 1026, ...) flutter: mdk.INFO: 10:30:46.765: 0x116867600-MediaControl::seek(pos: 60000, flag:0X402 +FromStart). now: 0 flutter: mdk.FINE: 10:30:46.765: default 0x115ea62e0-FrameReader::seek(60000, 0X402) flutter: mdk.FINE: 10:30:46.765: default 0x115ea62e0 FrameReader::update MediaStatus 0X2=>0X82 flutter: fvp.FINE: 10:30:46.765: 130332829 player4662066752 onMediaStatus: MediaStatus(+loading) => MediaStatus(+loading+seeking) flutter: mdk.FINE: 10:30:46.766: 0x115ea62e0 default FrameReaderImpl::seekTo(60000, 0X402 #1) flutter: mdk.FINE: 10:30:46.766: 0x115e674c0 player.setPlaybackRate(1.000000) flutter: mdk.FINE: 10:30:46.766: 0x115e674c0 player.set(1) flutter: mdk.FINE: 10:30:46.766: 0x116867600 virtual void mdk::MediaControlPush::setState(PlaybackState)@1068 requested state 1=>1, current state 0. status: 0X82 flutter: mdk.FINE: 10:30:46.766: AudioQueueStart ERROR: 0 flutter: mdk.FINE: 10:30:46.766: default FrameReader0x115ea62e0 request to pause 0, loaded: 0. flutter: mdk.FINE: 10:30:46.767: default FrameReader0x115ea62e0 state: 0=>1=>1, 0 flutter: mdk.FINE: 10:30:46.767: 0x115e674c0 player.setPlaybackRate(1.000000) flutter: mdk.FINE: 10:30:46.962: [FFmpeg:hls] Skip ('#EXT-X-VERSION:3') flutter: mdk.FINE: 10:30:46.962: [FFmpeg:hls] Skip ('#EXT-X-ALLOW-CACHE:YES') flutter: mdk.FINE: 10:30:47.021: [FFmpeg:hls] Opening 'https://mdn.alipayobjects.com/open_content/afts/img/A*ibbTQZGTzsoAAAAAAAAAAAAAcFx1AQ/original' for reading flutter: mdk.FINE: 10:30:47.242: [FFmpeg:hls] Opening 'https://mdn.alipayobjects.com/open_content/afts/img/A*nViNQIh0GrgAAAAAAAAAAAAAcFx1AQ/original' for reading flutter: mdk.FINE: 10:30:47.551: after avformat_open_input. pb: 0x1159ada00, iformat: 0x1111ce0d8, context flags: 2097152, input format flags: 49664 flutter: mdk.FINE: 10:30:47.551: [FFmpeg:hls] Could not find codec parameters for stream 0 (Video: png, none): unspecified size flutter: Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options flutter: mdk.FINE: 10:30:47.552: unsupported avformat options: rtsp_transport=tcp flutter: mdk.INFO: 10:30:47.552: Format: hls, range: 0 +2753520ms, bitrate: 298, size: 0 flutter: Programs: flutter: Program id 0 flutter: Metadata: flutter: variant_bitrate: 0 flutter: Video: flutter: track 0 stream#0, range: 0 +2753520ms, frames: 0 flutter: codec: png tag: 0 profile: -99 level: -99, unknown, bpc:0, bpp:0(), channels:(), map: 0 0 0 0, bitrate: 0, 0x0, fps: 25, bframes: 0 flutter: Metadata: flutter: variant_bitrate: 0 flutter:
flutter: mdk.FINE: 10:30:47.553: default 0x115ea62e0 FrameReader::update MediaStatus 0X82=>0X4
flutter: fvp.FINE: 10:30:47.554: 130332829 player4662066752 onMediaStatus: MediaStatus(+loading+seeking) => MediaStatus(+loaded)
flutter: fvp.FINE: 10:30:47.554: 130332829 player4662066752 already initialized
flutter: mdk.INFO: 10:30:47.554: 0x115ea62e0 buffering progress 0%
flutter: mdk.FINE: 10:30:47.555: default 0x115ea62e0 FrameReader::update MediaStatus 0X4=>0X14
flutter: mdk.FINE: 10:30:47.555: virtual void mdk::AudioBackendAudioQueue::pause(bool)138 ERROR>>> AudioQueuePause(queue_): -50
flutter: mdk.FINE: 10:30:47.555:
flutter: fvp.FINE: 10:30:47.555: 130332829 player4662066752 onMediaStatus: MediaStatus(+loaded) => MediaStatus(+loaded+buffering)
flutter: invalid or unsupported media
flutter: mdk.INFO: 10:30:47.556: ++++++++++++BUFFERING START++++++++++++
flutter: mdk.FINE: 10:30:47.556:
flutter: fvp.FINE: 10:30:47.556: 130332829 player4662066752 onEvent: reader.buffering - - 0
flutter: invalid or unsupported media
flutter: mdk.FINE: 10:30:47.557: default FrameReader0x115ea62e0 state: 0=>1=>1, 1
flutter: mdk.FINE: 10:30:47.557: default FrameReader0x115ea62e0 update state: 0=>1
flutter: fvp.FINE: 10:30:47.557: 130332829 player4662066752 onPlaybackStateChanged: PlaybackState.stopped => PlaybackState.playing
flutter: invalid or unsupported media
flutter: mdk.FINE: 10:30:47.557: default 0x115ea62e0 FrameReader::update MediaStatus 0X14=>0X54
flutter: fvp.FINE: 10:30:47.558: 130332829 player4662066752 onMediaStatus: MediaStatus(+loaded+buffering) => MediaStatus(+loaded+buffering+end)
flutter: mdk.FINE: 10:30:47.558: read packet error. FrameReader@0x115ea62e0 sending Packet::End to all packet queues. PacketIO@0x1159cf170 ->url: https://yundunm3.czys.art:88/vtt/gc02/sifangguan/sifangguan01.m3u8
flutter: mdk.FINE: 10:30:47.558: 0x115ea62e0 start to decode video#0 packet @59.996000/1.000000 pos: -9223372036854775808
flutter: mdk.INFO: 10:30:47.558: 0x115ea62e0 buffering progress 100%
flutter: mdk.FINE: 10:30:47.558: default 0x115ea62e0 FrameReader::update MediaStatus 0X54=>0X164
flutter: mdk.FINE: 10:30:47.558: starting decode loop thread mdk.vdec0@0x700004941000
flutter: mdk.FINE: 10:30:47.559: AudioQueueStart ERROR: 0
flutter: fvp.FINE: 10:30:47.559: 130332829 player4662066752 onMediaStatus: MediaStatus(+loaded+buffering+end) => MediaStatus(+loaded+prepared+buffered+end)
flutter: invalid or unsupported media
flutter: mdk.INFO: 10:30:47.559: ++++++++++++BUFFERING END++++++++++++
flutter: mdk.FINE: 10:30:47.559:
flutter: fvp.FINE: 10:30:47.560: 130332829 player4662066752 onEvent: thread.video - - 1
flutter: fvp.FINE: 10:30:47.560: 130332829 player4662066752 onEvent: reader.buffering - - 100
flutter: mdk.FINE: 10:30:47.560: 0x115ea62e0 video stream#0 starting decoding loop from decoder index 0...
flutter: mdk.FINE: 10:30:47.560: virtual int64_t mdk::PacketIOWrapper::seek(int64_t, SeekFlag)@704 seek target(from 0): 60000ms, flags: +FromStart. now: 0.000000
flutter: mdk.FINE: 10:30:47.560: 0x115ea62e0 creating video decoder: videotoolbox...
flutter: mdk.FINE: 10:30:47.560: default 0x115ea62e0 FrameReader::update MediaStatus 0X164=>0X1E4
flutter: fvp.FINE: 10:30:47.561: 130332829 player4662066752 onMediaStatus: MediaStatus(+loaded+prepared+buffered+end) => MediaStatus(+loaded+prepared+buffered+end+seeking)
flutter: mdk.FINE: 10:30:47.561: 0x115ea62e0 opening video decoder: videotoolbox...
flutter: mdk.FINE: 10:30:47.561: Seek start. target time: 60000000 avseek flags: 1
flutter: mdk.FINE: 10:30:47.561: opening ffmpeg video decoder: png
flutter: mdk.FINE: 10:30:47.561: 0x115e62fe0mdk::NativeVideoBufferPool::NativeVideoBufferPool()
flutter: mdk.FINE: 10:30:47.562: Try to use IOSurface OpenGL(ES) interop: false
flutter: mdk.FINE: 10:30:47.562: AVCodec.Video[png.] decoder: 1 Single threads
flutter: mdk.FINE: 10:30:47.562: unsupported avcodec options: hwcontext=videotoolbox shader_resource=0
flutter: mdk.FINE: 10:30:47.562: png 0x0 unknown
flutter: mdk.FINE: 10:30:47.562: 0x115e63030UGL::opengl::Context::Local
内容太多分2次发的,。invalid or unsupported media收到了很多次
你发我个测试代码
我重新测试了下我的代码也有问题,不过现在还是触发了2次 import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:fvp/fvp.dart'; import 'package:video_player/video_player.dart';
class TestPage extends StatelessWidget { const TestPage({super.key});
@override Widget build(BuildContext context) { registerWith(); var a = VideoPlayerController.networkUrl(Uri.parse( "https://yundunm3.czys.art:88/vtt/gc02/sifangguan/sifangguan01.m3u8")); a.addListener(() { if(a.value.hasError){ print("===${a.value.errorDescription}"); } }); print("====start"); return VideoPlayer(a..initialize()); } }
-========结果======= Restarted application in 531ms. flutter: ====start [2](flutter: ===invalid or unsupported media)
把两次value打印出来,区别是报错那次isCompleted是false,后面一次isCompleted是true表示播放结束,错误信息还是保留着,要不你判断下isCompleted
flutter: ===VideoPlayerValue(duration: 0:00:00.000000, size: Size(0.0, 0.0), position: 0:00:00.000000, caption: Caption(number: 0, start: 0:00:00.000000, end: 0:00:00.000000, text: ), captionOffset: 0:00:00.000000, buffered: [], isInitialized: false, isPlaying: false, isLooping: false, isBuffering: false, volume: 1.0, playbackSpeed: 1.0, errorDescription: bad video size, invalid or unsupported media, isCompleted: false),
flutter: ===VideoPlayerValue(duration: 0:00:00.000000, size: Size(0.0, 0.0), position: 0:00:00.000000, caption: Caption(number: 0, start: 0:00:00.000000, end: 0:00:00.000000, text: ), captionOffset: 0:00:00.000000, buffered: [], isInitialized: false, isPlaying: false, isLooping: false, isBuffering: false, volume: 1.0, playbackSpeed: 1.0, errorDescription: bad video size, invalid or unsupported media, isCompleted: true),
明白了感谢
相当于播放过程中出现错误了,看video_player源码value是个成员变量,在播放结束的时候只是把iscompleted设true了,所以这现象符合预期
发现新的问题,这个视频都是无法播放的,不应该用事件通知,目前initialize没有异常可以继续后续流程且isInitialized=true,有点不合理
我直接用initialize后的size来判断了,其实这里做异常就比较合理
试下master最新代码
很完美这样就和官方一致了
支持这类视频的ffmpeg已经有小伙伴编译出来了,可以在这下载 https://github.com/Predidit/avbuild/actions/runs/10561529946
替换相应的ffmpeg动态就行
感谢,我等会试试看,那他这种可以播放你说的那种带封面的mkv么?
jpeg封面支持,png没了
支持这类视频的ffmpeg已经有小伙伴编译出来了,可以在这下载 https://github.com/Predidit/avbuild/actions/runs/10561529946
替换相应的ffmpeg动态就行
还有就是ffmpeg下载的地方 lite和lite-lto的区别是什么
只有在ios-arm64_x86_64-maccatalyst里面找到了 libffmpeg.7.dylib,这个文件夹应该是用于maccatalyst,ios真机和模拟器文件夹下没有 libffmpeg.7.dylib
还有就是ffmpeg下载的地方 lite和lite-lto的区别是什么
lto是有更多优化的,一般用lto版本就行
ios、tvos, xros和macos不一样,只能用framework不能用dylib。下载ffmpeg-master-iOS-lite-lto后把里面的ffmpeg-master-iOS-lite-lto-shared.tar.xz解压出来,进入ffmpeg-master-iOS-lite-lto目录,运行
xattr -dr com.apple.quarantine lib/libffmpeg*.dylib
./dylib2framework.sh lib/libffmpeg.dylib
命令,lib目录会生成FFmpeg.framework,把这个framework拷贝到你的项目里,用xcode打开工程,把FFmpeg.framework添加到依赖里,然后编译生成的程序就会链接并打包这个framework,fvp会自动调用它。模拟器版本类似,要同时支持设备和模拟器的话先分别生成framework,再用命令行生成FFmpeg.xcframework,添加到xcode工程依赖里。如果是macos运行好xattr -dr com.apple.quarantine lib/libffmpeg*.dylib
后直接把mdk.framework/Versions/A/libffmpeg.7.dylib替换了就行。
我给ffmpeg的hls打了补丁,已经可以支持png和gif切片了 https://github.com/wang-bin/avbuild/actions/runs/11091150175
fvp下个版本会集成
另外,iOS的FFmpeg.xcframework也由ci生成了,可以从这下载 https://sourceforge.net/projects/avbuild/files/xcframework/
调试后再 /fvp-0.25.0/lib/src/player.dart final size = await _videoSize.future; 这这个位置就不会往下走了,系统能提供异常或事件
测试视频 https://yundunm3.czys.art:88/vtt/gc02/sifangguan/sifangguan01.m3u8