在exoplayer2上找不到同步字节m3u8

db2dz4w8  于 2021-07-12  发布在  Java
关注(0)|答案(0)|浏览(529)

我有一个aes 128位加密的m3u8播放列表。我试着主持这个节目,
通过cloudflare的google云存储桶
本地xampp服务器
播放列表在HTML5Web播放器上工作。然后我尝试在android应用程序中播放m3u8文件。我试过,一个flatter应用程序,一个react原生应用程序和一个原生java应用程序
我已经尝试了几乎所有的hls库,用于flutter和react native。但是在最后,每个玩家都显示了关于googleexoplayer的相同错误。我已经花了将近一个月的时间来解决这个问题。我已经检查了github的大部分问题,但没有运气。
这就是我看到的错误(从flatter终端复制,但是对于rn和原生java应用程序也显示了相同的错误)

Restarted application in 4,802ms.
I/ExoPlayerImpl(25099): Release 2354449 [ExoPlayerLib/2.13.1] [m21, SM-M215F, samsung, 30] [goog.exo.core, goog.exo.hls]
I/ExoPlayerImpl(25099): Init 91918d7 [ExoPlayerLib/2.13.1] [m21, SM-M215F, samsung, 30]
6
I/System.out(25099): (HTTPLog)-Static: isSBSettingEnabled false
E/ExoPlayerImplInternal(25099): Playback error
E/ExoPlayerImplInternal(25099):   com.google.android.exoplayer2.ExoPlaybackException: Source error
E/ExoPlayerImplInternal(25099):       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:579)
E/ExoPlayerImplInternal(25099):       at android.os.Handler.dispatchMessage(Handler.java:102)
E/ExoPlayerImplInternal(25099):       at android.os.Looper.loop(Looper.java:246)
E/ExoPlayerImplInternal(25099):       at android.os.HandlerThread.run(HandlerThread.java:67)
E/ExoPlayerImplInternal(25099):   Caused by: com.google.android.exoplayer2.ParserException: Cannot find sync byte. Most likely not a Transport Stream.
E/ExoPlayerImplInternal(25099):       at com.google.android.exoplayer2.extractor.ts.TsExtractor.findEndOfFirstTsPacketInBuffer(TsExtractor.java:453)
E/ExoPlayerImplInternal(25099):       at com.google.android.exoplayer2.extractor.ts.TsExtractor.read(TsExtractor.java:320)
E/ExoPlayerImplInternal(25099):       at com.google.android.exoplayer2.source.hls.BundledHlsMediaChunkExtractor.read(BundledHlsMediaChunkExtractor.java:67)
E/ExoPlayerImplInternal(25099):       at com.google.android.exoplayer2.source.hls.HlsMediaChunk.feedDataToExtractor(HlsMediaChunk.java:434)
E/ExoPlayerImplInternal(25099):       at com.google.android.exoplayer2.source.hls.HlsMediaChunk.loadMedia(HlsMediaChunk.java:404)
E/ExoPlayerImplInternal(25099):       at com.google.android.exoplayer2.source.hls.HlsMediaChunk.load(HlsMediaChunk.java:355)
E/ExoPlayerImplInternal(25099):       at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:415)
E/ExoPlayerImplInternal(25099):       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/ExoPlayerImplInternal(25099):       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/ExoPlayerImplInternal(25099):       at java.lang.Thread.run(Thread.java:923)
E/flutter (25099): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException: Source error, null, null)
E/flutter (25099):

我还要添加m3u8文件的内容,


# EXTM3U

# EXT-X-VERSION:3

# EXT-X-TARGETDURATION:12

# EXT-X-MEDIA-SEQUENCE:0

# EXT-X-KEY:METHOD=AES-128,URI="http://192.168.1.2/key/video.key",IV=0x00000000000000000000000000000000

# EXTINF:10.666667,

playlist0.ts

# EXTINF:11.666667,

playlist1.ts

# EXT-X-ENDLIST

我知道问题出在 TS 错误消息显示错误后的文件 TsExtractor.java 文件。在这里,我还尝试用curl查看其中一个ts文件的http响应头,

C:\Users\mdils>curl -D - http://localhost/key/playlist0.ts
HTTP/1.1 200 OK
Date: Fri, 23 Apr 2021 16:01:24 GMT
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1g PHP/7.4.11
Last-Modified: Sun, 28 Feb 2021 15:29:09 GMT
ETag: "239f80-5bc6729a3ba75"
Accept-Ranges: bytes
Content-Length: 2334592
Access-Control-Allow-Origin: *

谢谢你的帮助。
更新
播放列表示例-https://drive.google.com/drive/folders/1q6mjny5ht-wlmqaumpfbvmhacumw73xz?usp=sharing
用于编码的ffmpeg命令

ffmpeg -i input.mp4 -c copy -bsf:v h264_mp4toannexb -hls_list_size 0 -hls_time 10 -hls_key_info_file key_info.txt playback.m3u8

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题