最终目标:创建一个可播放可从我的自定义框架(可可豆)中调用的视频的功能
我已经完成的事情:
将视频(SampleVideo.mp4)放入我的框架中复制捆绑资源
使用以下代码更新了我的.podspec
文件:
s.resources = "JacquardToolkit/*,mp4"
s.resource_bundles = {
'JacquardToolkit' => ['JacquardToolkit/Pods/**/*.mp4']
}
guard let path = Bundle.main.path(forResource: "SampleVideo", ofType:"mp4") else {
debugPrint("SampleVideo.mp4 not found")
return
}
player = AVPlayer(url: URL(fileURLWithPath: path))
let playerLayer = AVPlayerLayer(player: player)
playerLayer.frame = self.layer.bounds
playerLayer.videoGravity = .resizeAspectFill
player.play()
到目前为止,这没有用。我不断收到“找不到SampleVideo.mp4”的错误。如何在自定义框架中添加和使用.mp4?