使用 MobileVLCKit 在 iOS 上播放 AVI 索引损坏的视频文件

Play video file with broken AVI index on iOS using MobileVLCKit

我正在为 iOS 开发视频流应用程序,我遇到了一个问题 - 该应用程序应该能够播放部分下载的视频。我无法直接从服务器流式传输视频,因为没有服务器,视频是使用 P2P 网络下载的。下载从文件的开头开始,大约 20% 后我希望能够播放文件。

目前我正在尝试使用 MobileVLCKit。当我尝试在 Mac 上使用 VLC 播放器播放部分下载的文件(大约 30%)时,VLC 告诉我:“Broken or missing AVI Index”并提供“ 按原样播放”或“构建索引然后播放”,当我选择“按原样播放时" 视频开始播放,但是在 iOS 上,当我尝试播放同一视频时,当 MobileVLCKit 调用 AVI_IndexCreate 时,我得到 BAD_ACCESS。有没有一种方法可以强制 MobileVLCKit 播放索引损坏的视频 "as is",或者我可以通过其他一些方法做到这一点?非常感谢。

更新:

控制台输出:

[1389:617849] creating player instance using shared library
[1759f504] core generic error: option marq-color does not exist
[1759f504] core generic error: option marq-opacity does not exist
[1759f504] core generic error: option marq-position does not exist
[1759f504] core generic error: option marq-refresh does not exist
[1759f504] core generic error: option marq-size does not exist
[1759f504] core generic error: option marq-timeout does not exist
[1759f504] core generic error: option marq-x does not exist
[1759f504] core generic error: option marq-y does not exist
[176f8264] avi demux error: no key frame set for track 0
[176f8264] avi demux error: no key frame set for track 1

回溯:

(lldb) bt
* thread #8: tid = 0x976f9, 0x20000000, stop reason = EXC_BAD_ACCESS (code=1, address=0x20000000)
    frame #0: 0x20000000
  * frame #1: 0x00675d72 testApp'Open [inlined] AVI_IndexCreate + 542 at avi.c:2407
    frame #2: 0x00675b54 testApp'Open(p_this=<unavailable>) + 5228 at avi.c:631
    frame #3: 0x0065111e testApp'vlc_module_load [inlined] module_load(obj=<unavailable>, init=<unavailable>, args=0x04d29d94, args=0x04d29d94, args=<unavailable>) + 814 at modules.c:185
    frame #4: 0x00651100 testApp'vlc_module_load(obj=0x155f7654, capability=0x008fdd2e, name=<unavailable>, strict=false, probe=<unavailable>) + 784 at modules.c:277
    frame #5: 0x0065129a testApp'module_need(obj=<unavailable>, cap=<unavailable>, name=<unavailable>, strict=<unavailable>) + 30 at modules.c:366
    frame #6: 0x0062ae9a testApp'demux_New + 734
    frame #7: 0x00634a4c testApp'InputSourceInit + 2624
    frame #8: 0x00631e74 testApp'Init + 580
    frame #9: 0x00633c7a testApp'Run + 18
    frame #10: 0x35542e92 libsystem_pthread.dylib'_pthread_body + 138
    frame #11: 0x35542e06 libsystem_pthread.dylib'_pthread_start + 118

默认情况下,VLCKit 会尝试修复损坏的 AVI 索引,要禁用此行为,您需要将 --avi-index=2 参数传递给播放器。在 iOS 上,您可以在 init 上执行此操作,如下所示:

VLCMediaPlayer *player = [[VLCMediaPlayer alloc] initWithOptions:@[@"--avi-index=2"]];