InStatPlayer
使用
InStatPlayer是一个灵活的媒体播放器,播放队列由嵌套的数组AVPlayerItem组成,这使得它很容易获取IndexPath,与UITableView交互非常方便。
通过打开示例项目可以查看如何轻松地操作UITableView。要运行示例项目,请首先从GitHub克隆仓库,然后在示例目录中运行pod install
。
InStatPlayerDelegate
为了从InStatPlayer获取更多信息,您应该遵守InStatPlayerDelegate协议。
@objc optional func player(_ player: InStatPlayerView,
ready item: AVPlayerItem,
at indexPath: IndexPath)
@objc optional func player(_ player: InStatPlayerView,
didPlay item: AVPlayerItem,
at indexPath: IndexPath)
@objc optional func player(_ player: InStatPlayerView,
didPause item: AVPlayerItem,
at indexPath: IndexPath)
@objc optional func player(_ player: InStatPlayerView,
didStop item: AVPlayerItem,
at indexPath: IndexPath)
@objc optional func player(_ player: InStatPlayerView,
didFail error: Error,
item: AVPlayerItem,
at indexPath: IndexPath)
@objc optional func playerDidFullscreen(_ player: InStatPlayerView)
@objc optional func player(_ player: InStatPlayerView,
didChangeTo time: Float64,
for item: AVPlayerItem,
at indexPath: IndexPath,
total: Float64)
@objc optional func player(_ player: InStatPlayerView,
willStartFromBeginning item: AVPlayerItem,
at indexPath: IndexPath)
@objc optional func player(_ player: InStatPlayerView,
didEnd item: AVPlayerItem,
at indexPath: IndexPath)
@objc optional func player(_ player: InStatPlayerView,
willLoop item: AVPlayerItem,
at indexPath: IndexPath)
@objc optional func player(_ player: InStatPlayerView,
bufferingUnknown item: AVPlayerItem,
at indexPath: IndexPath)
@objc optional func player(_ player: InStatPlayerView,
bufferingReady item: AVPlayerItem,
at indexPath: IndexPath)
@objc optional func player(_ player: InStatPlayerView,
bufferingDelayed item: AVPlayerItem,
at indexPath: IndexPath)
@objc optional func player(_ player: InStatPlayerView,
bufferingTimeDidChangeTo time: Float64,
item: AVPlayerItem,
at indexPath: IndexPath,
total: Float64)
@objc optional func player(_ player: InStatPlayerView,
seekTo time: Double,
for item: AVPlayerItem,
at indexPath: IndexPath)
定制
通过调用InStatControlView的customizeControlView()方法,您可以按照您的意愿定制控件。项目示例提供了一种实现此目标的方法。
安装
InStatPlayer可通过CocoaPods获取。要安装它,只需在您的Podfile中添加以下行
pod 'InStatPlayer'
作者
Beslan Tularov | @JiromTomson
许可协议
MIT License
Copyright (c) 2018 Beslan Tularov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.