zoukankan      html  css  js  c++  java
  • 视频播放一

    1.使用注意事项

    导入框架
    #import <AVKit/AVKit.h>
    #import <AVFoundation/AVFoundation.h>
    

    2.使用

    AVPlayerViewController *_playerVc;
     Video *video = _videos[indexPath.row];
        NSString *url = [baseUrlStr stringByAppendingPathComponent:video.url];
      
        //ios9.0以下
        if([[UIDevice currentDevice].systemVersion doubleValue] >= 9.0){
            if (_playerVc == nil) {
                _playerVc = [[AVPlayerViewController alloc] init];
            }
            _playerVc.player = [[AVPlayer alloc] initWithURL:[NSURL URLWithString:url]];
            /*
             可以设置的值及意义如下:
             AVLayerVideoGravityResizeAspect   不进行比例缩放 以宽高中长的一边充满为基准
             AVLayerVideoGravityResizeAspectFill 不进行比例缩放 以宽高中短的一边充满为基准
             AVLayerVideoGravityResize     进行缩放充满屏幕
             */
            _playerVc.videoGravity = AVLayerVideoGravityResizeAspectFill;
            [self presentViewController:_playerVc animated:YES completion:nil];
            [_playerVc shouldAutorotate];
        }else{
    //需要导入#import <MediaPlayer/MediaPlayer.h>框架
            MPMoviePlayerViewController *play = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:url]];
            [self presentViewController:play animated:YES completion:nil];
        }
    

      

      

  • 相关阅读:
    PHP -----上传文件
    PHP----预定义数组
    PHP-------- 会话控制
    PHP------XML
    PHP----练习-----三级联动
    PHP-------ajax返回值 返回JSON 数据
    PHP----练习----光标离开文本框时变色
    使用ansible安装配置zabbix客户端
    svn+apache安装配置
    rsync+lsyncd实现实时同步
  • 原文地址:https://www.cnblogs.com/TheYouth/p/6745252.html
Copyright © 2011-2022 走看看