kingslay / KSPlayer

A video player for iOS、macOS、tvOS、visionOS , based on AVPlayer and FFmpeg, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, SwiftUI, support subtitles.
https://apps.apple.com/app/tracyplayer/id6450770064
GNU General Public License v3.0
980 stars 198 forks source link

播放多音轨视频出错 #722

Closed fandongtongxue closed 8 months ago

fandongtongxue commented 8 months ago

拿URL给KSPlayer播放出错 第一张图是写的代码 WX20240116-140214@2x 第二张图是报错位置 WX20240116-140032@2x 附上控制台日志 ksplayer.log

fandongtongxue commented 8 months ago

控制台打印 po codecpar.field_order.rawValue 3516692992

超出了UInt8的最大值

kingslay commented 8 months ago

报错的是音轨还是视频轨呢?可以上传下视频片段到github。这样我才能debug

fandongtongxue commented 8 months ago

感谢关注,后来用你这个demo-iOS测试了下可以播放,没啥问题,我用的是develop分支,直接把你的detailvc复制过来了, 方法也同步了 let resource = KSPlayerResource(url: URL(string: resp.url!)!) self.play(resource: resource)

func play(resource: KSPlayerResource?) { let controller = KSPlayerVC() controller.resource = resource self.actionPS.onNext(VMActionType.push(vc: controller, animated: true)) } Appdelegate里 KSOptions.canBackgroundPlay = true KSOptions.logLevel = .debug KSOptions.firstPlayerType = KSMEPlayer.self KSOptions.secondPlayerType = KSMEPlayer.self // KSOptions.supportedInterfaceOrientations = .all KSOptions.isAutoPlay = true KSOptions.isSecondOpen = true KSOptions.isAccurateSeek = true 一会我写个demo看看

fandongtongxue commented 8 months ago

你的demo我测试没问题,我写的就不行呢,我用spm,你用pod的缘故? 我的demo KSDemo.zip

kingslay commented 8 months ago

我的demo里面都有pod和spm的例子。你可以用我的spm的例子试下。如果demo没有问题的话,那你就要检查你的代码,看是哪里有问题。如果你一直找不到问题的话,那可以找我寻求技术支持。

fandongtongxue commented 8 months ago

作者,您好,我找到问题了,我在项目里也集成了百度网盘的播放器sdk,所以出现了这个问题,你的ffmpeg被他的ffmpeg影响了