iOS 視頻播放,ios視頻播放

來源:互聯網
上載者:User

iOS 視頻播放,ios視頻播放

  • 這是一個使用簡便的視頻播放架構,它基於UIView,它可以是一個小視窗,也可以是一個全屏的視窗
  • 簡單的方式載入Video架構: 一行代碼載入! 一行代碼更新!

  • 下載連結 : https://github.com/huyp/YVideoPlayer
功能
  • 支援本地視頻&網路視頻
  • 開始&暫停
  • 最大化&還原
  • 映像左側上下調節 : 亮度 
  • 映像右側上下調節 : 音量
  • 左右滑動 : 快進快退
簡介
  • 這是一個UIView的子類,它可以載入到你所需要的任何位置.
  • 它可以是一個小視窗,也可以是一個全屏的視窗
  • 支援方向識別,橫屏時自動最大化

 

 

使用載入:
匯入標頭檔#import "YVideoPlayerView.h"
yVideoPlayerView = [YVideoPlayerView initWithVideoName:@"視頻名稱1" frame:CGRectMake(0,20,200,150) path:@"http://videoPath" onViewControll:self];初始化方法+ (instancetype)initWithVideoName:(NSString *)name frame:(CGRect)frame path:(NSString *)path onViewControll:(UIViewController *)OnViewController;name : 視頻名稱frame : 視頻位置path : 視頻路徑onViewController : 載入視頻所在的ViewController -> 一般寫self
更新:
yVideoPlayerView = [yVideoPlayerView updateVideoWithName:@"視頻名稱2" path:@"http://videoPath2" onViewController:self];注意 : 這是一個對象方法- (instancetype)updateVideoWithName:(NSString *)name path:(NSString *)path onViewController :(UIViewController *)OnViewController;name : 視頻名稱path : 視頻路徑onViewController : 載入視頻所在的ViewController -> 一般寫self這裡不用重寫frame -- 參照了初始化時
提醒
  • 本架構純ARC,相容的系統>=iOS6.0、iPhone\iPad橫豎屏
  • 橫豎屏需要手機關閉橫豎排方向鎖定
  • App至少要開啟LandScape Left 或 LandScape Right其中的一項. 如App其他頁面不能轉屏,用代碼鎖定!
    • 在其他不需要轉屏的根視圖裡寫如下代碼:
      - (UIInterfaceOrientationMask)supportedInterfaceOrientations {      return UIInterfaceOrientationMaskPortrait;  }
    • 在載入YVideoPlayerView的ViewController裡寫如下代碼:
      //只讓這個頁面轉動  - (BOOL)shouldAutorotate {      return YES;  }  - (UIInterfaceOrientationMask)supportedInterfaceOrientations {      if (yVideoPlayerView.canOrientationChange == YES) {  //剛進入頁面是豎屏          return UIInterfaceOrientationMaskAllButUpsideDown;      }      return UIInterfaceOrientationMaskPortrait;  }

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.