简体   繁体   English

iOS-Media Player卡在“正在加载...”

[英]IOS - Media Player stuck on “Loading…”

I have added the MediaPlayer library and written the code to play a video in fullscreen mode. 我已经添加了MediaPlayer库并编写了代码以全屏模式播放视频。

I also added a button in my view which is linked to a function that fires up the MediaPlayer with an external Video URL. 我还在视图中添加了一个按钮,该按钮链接到使用外部视频URL触发MediaPlayer的功能。 Now I am sure the code is correct because MediaPlayer is being loaded into the screen, and if I try a wrong URL it will display an error. 现在我确定代码正确,因为MediaPlayer正在加载到屏幕上,如果我输入错误的URL,它将显示错误。

The problem is, the MediaPlayer is stuck and display at the top "Loading..." all the time. 问题是,MediaPlayer被卡住并始终显示在顶部“正在加载...” I tried to play the video in my browser and it worked. 我试图在浏览器中播放视频,但效果良好。 I also tried a different video from another server in the browser and it worked too, but never in MediaPlayer. 我还在浏览器中尝试了与另一台服务器不同的视频,它也可以工作,但是在MediaPlayer中却没有。

Also, clicking the "Done" button in MediaPlayer has not effect and doesn't return me to the view I was in before launching it! 另外,单击MediaPlayer中的“完成”按钮也无效,并且不会使我返回到启动之前的视图! It keeps MediaPlayer on screen all the time with that "Loading..." stuck. 它始终将MediaPlayer保持在屏幕上,并显示“正在加载...”。

I am using XCode 4.5 and IOS Simulator 6.0 我正在使用XCode 4.5和IOS Simulator 6.0

This answer really helped me. 这个答案确实帮助了我。

mediaplayer framework not playing video in iOS 6 Mediaplayer框架无法在iOS 6中播放视频

Added the controller and loaded it from the UIViewController instead of another UIView was the key to success in my case. 添加控制器并从UIViewController而不是另一个UIView加载是我而言成功的关键。

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

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