pili-engineering / PLPlayerKit

PLPlayerKit 是七牛推出的一款免费的适用于 iOS 平台的播放器 SDK,采用全自研的跨平台播放内核,拥有丰富的功能和优异的性能,可高度定制化和二次开发。
https://developer.qiniu.com/pili/sdk/1211/ios-playback-end-the-sdk
2.01k stars 408 forks source link

Initialization Issue in Swift #549

Closed jxxnnee closed 3 years ago

jxxnnee commented 3 years ago

Initialization Issue




Project-Bridging-Header.h

#ifndef Project_Bridging_Header_h
#define Project_Bridging_Header_h

#import <PLPlayerKit/PLPlayerKit.h>

#endif 



Initialization Code

option.setOptionValue(15, forKey: PLPlayerOptionKeyTimeoutIntervalForMediaPackets)
/// Indicate Latency Option
option.setOptionValue(2000, forKey: PLPlayerOptionKeyMaxL1BufferDuration)
option.setOptionValue(1000, forKey: PLPlayerOptionKeyMaxL2BufferDuration)
/// HardWare Encoding/Decoding Option
option.setOptionValue(false, forKey: PLPlayerOptionKeyVideoToolbox)
option.setOptionValue(kPLLogDebug, forKey: PLPlayerOptionKeyLogLevel)

self.player = PLPlayer(url: rtmpURL, option: option) <---- Make Problem Here
self.player.delegate = self

 if let playerView = self.player.playerView {
    self.view.addSubview(playerView)
    playerView.snp.makeConstraints({
        $0.center.equalTo(self.view)
        $0.width.height.equalTo(self.view)
    })
}



Error Description

libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '-[__SwiftValue intValue]: unrecognized selector sent to instance 0x2812bac70'
terminating with uncaught exception of type NSException
jxxnnee commented 3 years ago

i fixed it option.setOptionValue(kPLLogDebug, forKey: PLPlayerOptionKeyLogLevel) => option.setOptionValue(4, forKey: "PLPlayerOptionKeyLogLevel")

must use rawValue