AAPlayer 1.0.3

AAPlayer 1.0.3

测试已测试
Lang语言 SwiftSwift
许可 MIT
发布上一个版本2017年10月
SwiftSwift 版本3.0
SPM支持 SPM

ALAN881 维护。



AAPlayer 1.0.3

  • Alan

AAPlayer

基于 AVPlayer 的自定义视频播放器

功能

  • 纯 Swift 3.1 代码
  • 使用 UIGraphics 绘制按钮图标
  • 支持的视频格式:HLS, mp4
  • 需要 iOS 8 或以上版本

播放状态

安装

用法

您必须在安装 AAPlayer 后在 storyboard 中创建 UIView 并使用自定义类。

然后您还必须在您的 UIViewController 类中创建一个 IBOutlet 并实现 AAPlayerDelegate。

以下供您参考的示例代码。

    override func viewDidLoad() {
        super.viewDidLoad()
     
        sourceArray = ["http://clips.vorwaerts-gmbh.de/VfE_html5.mp4","http://live.zzbtv.com:80/live/live123/800K/tzwj_video.m3u8","http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8","http://bos.nj.bpc.baidu.com/tieba-smallvideo/0173bbaf5acf62b815a7de0544730d6c.mp4","http://bos.nj.bpc.baidu.com/tieba-smallvideo/00a52c5e2213216ce0ce3795d40e9492.mp4","http://bos.nj.bpc.baidu.com/tieba-smallvideo/0045ab5a9e440defb2611658c0914724.mp4"]
        player.delegate = self
        player.playVideo(sourceArray[currentIndex] as! String)
    }
    //optional method
    func callBackDownloadDidFinish(_ status: playerItemStatus?) {
        
        let status:playerItemStatus = status!
        switch status {
        case .readyToPlay:
            break
        case .failed:
            break
        default:
            break
        }
    }
    func startPlay() {
        //optional method
        player.startPlayback()
    }
    
    func stopPlay() {
        //optional method
        player.pausePlayback()
    }

许可

AAPlayer 根据 MIT 许可证提供。有关更多信息,请参阅 LICENSE 文件。