iOS 如何通过 URL 播放视频 [英] how iOS play the video by URL
本文介绍了iOS 如何通过 URL 播放视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过 URL 播放视频.我看到一些示例,代码如下:
I want to play a video by the URL. I see some sample,the codes like below:
NSString *movieFile= [[NSBundle mainBundle] pathForResource:@"android" ofType:@"mp4"];
videoURL=[[NSURL alloc] initFileURLWithPath:movieFile];
moviePlayer=[[MPMoviePlayerController alloc] initWithContentURL:videoURL];
它只播放本地资源.我写了一些代码,如:
It play only the local resource.I write some code like:
NSString* strurl =@"https://s3.amazonaws.com/adplayer/colgate.mp4";
videoURL=[NSURL fileURLWithPath:strurl];
moviePlayer=[[MPMoviePlayerController alloc] initWithContentURL:videoURL];
但是什么都没有......为什么......以及如何通过网址播放视频?
but there is nothing ... why..and how to play video by the url ?
推荐答案
尝试
NSURL *url = [NSURL URLWithString: strurl];
这篇关于iOS 如何通过 URL 播放视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文