【发布时间】:2017-03-29 05:20:20
【问题描述】:
我将我的 MP4 视频存储在谷歌云存储中,并尝试使用 MPMoviePlayerController 在 iOS 设备中播放它们,但它没有播放。但是,如果我将 Dropbox 上的相同文件上传到公共,它可以正常播放。
let videoURLWithPath = "https://storage.googleapis.com/pioctave/577265bce6058511008a39dd/57bc34d5683eb51100173a46-video/pioctave.mp4"
print(videoURLWithPath)
let videoURL = NSURL(string: videoURLWithPath)
moviePlayer = MPMoviePlayerController(contentURL: videoURL)
moviePlayer.view.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, self.header_video_img!.frame.size.height)
self.view.addSubview(moviePlayer.view)
moviePlayer.fullscreen = false
moviePlayer.shouldAutoplay = true
moviePlayer.controlStyle = MPMovieControlStyle.Fullscreen
moviePlayer.scalingMode = MPMovieScalingMode.AspectFill
moviePlayer.play()
我在 android 中使用了来自 GCS 的相同文件,它运行良好。以下是视频的示例公共 URL。
是否有任何标题问题或设备端是否存在问题。请帮忙。
【问题讨论】:
标签: ios video media-player google-cloud-storage mpmovieplayercontroller