当前位置:网站首页 > IOS编程 > 正文

在线视频地址 ios播放在线视频

播放在线的网络视频

UIWebView *myWeb = [[UIWebView alloc] initWithFrame:self.view.bounds];

NSURL *url = [NSURLURLWithString:@"
http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"];
http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8//这里也可以是 mp4

NSURLRequest *request = [NSURLRequest requestWithURL:url];

[myWeb setDelegate:self];

[myWeb loadRequest:request];

//AVPlayerLayer 播放在线视频 

NSURL *sourceMovieURL = [NSURL URLWithString:@"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"];

AVAsset *movieAsset    = [AVURLAsset URLAssetWithURL:sourceMovieURLoptions:nil];

AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:movieAsset];

AVPlayer *player = [AVPlayer playerWithPlayerItem:playerItem];

AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:player];

playerLayer.frame = self.view.layer.bounds;

playerLayer.videoGravity = AVLayerVideoGravityResizeAspect;

[self.view.layer addSublayer:playerLayer];

转载请标明出处,黄志勇的个人博客!

//MPMoviePlayerController 播放在线视频 

NSURL *videoURL = [NSURLURLWithString:@"https://s3.amazonaws.com/adplayer/colgate.mp4"];

MPMoviePlayerViewcontroller *moviePlayerController = [[MPMoviePlayerViewcontroller alloc] initWithContentURL:videoURL];

moviePlayerController.moviePlayer.movieSourceType = MPMovieSourceTypeFile;

moviePlayerController.moviePlayer.shouldAutoplay = YES;

//moviePlayerController.moviePlayer.controlStyle = MPMovieControlStyleNone;

[moviePlayerController.moviePlayer prepareToPlay];

[moviePlayerController.moviePlayer play];

[[NSnotificationCenter defaultCenter]

addObserver: self

selector: @selector(myMovieFinishedCallback:)

name: MPMoviePlayerPlaybackDidFinishnotification

object: moviePlayerController];

[self presentMoviePlayerViewcontrollerAnimated:moviePlayerController];

到此这篇在线视频地址 ios播放在线视频的文章就介绍到这了,更多相关内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!

版权声明


相关文章:

  • iOS中AVPlayer的在线播放和播放进度条,音量条以及AVPlayer的后台播放2024-11-23 18:36:05
  • iOS 蓝牙编程_iOS 蓝牙编程2024-11-23 18:36:05
  • iOS开发入门学习路线_ios开发入门教程2024-11-23 18:36:05
  • ios python3.0编程软件_ios编程软件-7款学习Python编程的iPhone/iPad应用_ios python3.0编程软件_ios编程软件-7款学习Python编程的iPhone/iPad应用2024-11-23 18:36:05
  • IOS编程——Socket传输汉字_socket传输中文2024-11-23 18:36:05
  • 在线视频地址 ios播放在线视频2024-11-23 18:36:05
  • iOS中AVPlayer的在线播放和播放进度条,音量条以及AVPlayer的后台播放2024-11-23 18:36:05
  • 在线视频地址 ios播放在线视频2024-11-23 18:36:05
  • iOS中AVPlayer的在线播放和播放进度条,音量条以及AVPlayer的后台播放2024-11-23 18:36:05
  • 看雪学院——好网站2024-11-23 18:36:05
  • 全屏图片