YouTubeFloatingPlayer 2.0.1

YouTubeFloatingPlayer 2.0.1

测试测试
语言语言 SwiftSwift
许可证 自定义
发布最新发布2017年8月
SwiftSwift版本3.0
SPM支持SPM

Advaita Pandya维护。



  • 作者:
  • Advaita Pandya

YouTubeFloatingPlayer

一个受YouTube启发的Swift视频播放器。基于SwiftYouTubeFloatingPlayer

功能

  • 交互式,拖动以最小化,滑动以关闭
  • 支持TableView以及任何UIView来显示视频详情

要求

目前YTFPlayer仅支持仅支持横竖屏的iOS应用。要实现以下代码,必须在AppDelegate中实现。

func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask {
    return UIInterfaceOrientationMask.portrait
}

依赖项

示例

要运行示例项目,请克隆库,然后首先从示例目录中运行pod install

安装

CocoaPods是一个Cocoa项目的依赖管理器。您可以使用以下命令安装它

$ gem install cocoapods

使用CocoaPods将YouTubeFloatingPlayer集成到您的Xcode项目时,请在您的Podfile中指定它

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'YouTubeFloatingPlayer'
end

然后,运行以下命令

$ pod install

使用方法

导入库

import YouTubeFloatingPlayer

使用YTFPlayer.initYTF()方法以期望的属性初始化播放器。

let videoID = "f0NdOE5GTgo"
// Initiates Player with an empty details view
YTFPlayer.initYTF(with: UIView(), videoID: videoID)
// Initiates Player with a tableView with other content
YTFPlayer.initYTF(with: tableView, tableCellNibName: "VideoCell", tableCellReuseIdentifier: "videoCell", videoID: videoID)

一旦初始化,请使用YTFPlayer.showYTFView()方法,其参数设置为期望的ViewController。

YTFPlayer.showYTFView(viewController: self)

最后,使用finishYTFView()方法从视图中删除播放器。

// Remove Player
finishYTFView(animated: true)

作者

Advaita Pandya,[email protected]

许可证

YouTubeFloatingPlayer可在GNU GPLv3许可证下使用。有关更多信息,请参阅LICENSE文件。