简体   繁体   English

MPMoviePlayerViewController无法通过流播放视频吗?

[英]MPMoviePlayerViewController Not playing video by streaming?

I am using the below code to play the video, but its working fine while using the local url that mean resourse file path. 我正在使用以下代码播放视频,但使用本地URL(表示资源文件路径)时可以正常工作。 Not working for server url. 无法用于服务器网址。

player = [[MPMoviePlayerViewController alloc] initWithContentURL:urlvalue];
player.view.frame = CGRectMake(10, 10, 800, 800);
player.moviePlayer.shouldAutoplay=YES;

player.moviePlayer.movieSourceType= MPMovieSourceTypeFile;
[player.moviePlayer setControlStyle:MPMovieControlStyleDefault];

[self.view addSubview:player.view];
[player.moviePlayer prepareToPlay];
[player.moviePlayer play];

Kindly correct me if I missed out something. 如果我错过了一些事情,请纠正我。 Thanks in advance. 提前致谢。

Pay attention on iOS 9 App transport security. 注意iOS 9 App传输安全性。 If you haven't set it up, streaming will fail with black empty screen. 如果您尚未进行设置,则流式传输将失败并显示黑屏。

Change movieSourceType from File to Streaming : movieSourceTypeFile更改为Streaming

player.moviePlayer.movieSourceType= MPMovieSourceTypeStreaming;

Note : url should be a streaming url not physical file path 注意: url应该是streaming url而不是physical file path

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM