gpt4 book ai didi

ios - 从 iOS 设备播放视频文件

转载 作者:搜寻专家 更新时间:2023-11-01 05:44:45 27 4
gpt4 key购买 nike

我在我的 iOS 应用程序上播放视频。

func playVideo() {
if let path = NSBundle.mainBundle().pathForResource("video", ofType:"mp4"),
url = NSURL(fileURLWithPath: path),
moviePlayer = MPMoviePlayerController(contentURL: url) {
self.moviePlayer = moviePlayer
moviePlayer.view.frame = self.view.bounds
moviePlayer.prepareToPlay()
moviePlayer.controlStyle = MPMovieControlStyle.None
moviePlayer.view.frame = CGRect(x: 0, y: 0, width: UIScreen.mainScreen().bounds.width, height: UIScreen.mainScreen().bounds.height)
moviePlayer.scalingMode = .AspectFill
self.view.addSubview(moviePlayer.view)

if (oldMoviePlayer != nil){
println("Animation Run")
UIView.transitionFromView(oldMoviePlayer!.view, toView: moviePlayer.view, duration: 1.0, options: transitionOptions, completion: nil)
}
oldMoviePlayer = moviePlayer

} else {
debugPrintln("Ops, something wrong when playing video.m4v")
}
}

现在我的项目中保存了 video.mp4 文件。

如何从我的设备而不是项目中播放视频?

我可以从设备获取视频的路径和名称吗?

最佳答案

关于ios - 从 iOS 设备播放视频文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31019285/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com