用 Swift 编写的简单视频播放器
示例: ViewController > viewDidLoad
let mLVideoPlayer = MLVideoPlayer(url: "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4", width: 280, height: 200)
self.addChild(mLVideoPlayer.viewController)
self.view.addSubview(mLVideoPlayer.viewController.view)
mLVideoPlayer.viewController.didMove(toParent: self)
MLLineChart 文档 (100% 已记录)
CocoaPods 是 Cocoa 项目的依赖管理工具。 您可以使用以下命令安装它
$ gem install cocoapods
要使用 CocoaPods 将 MLVideoPlayer 集成到您的 Xcode 项目中,请在您的 Podfile
中指定它
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
pod 'MLVideoPlayer', '~> 1.0.0'
然后,运行以下命令
$ pod install
Carthage 是一种分散式依赖管理工具,可以自动将框架添加到您的 Cocoa 应用程序。
您可以使用 Homebrew 通过以下命令安装 Carthage
$ brew update
$ brew install carthage
要使用 Carthage 将 MLVideoPlayer 集成到您的 Xcode 项目中,请在您的 Cartfile
中指定它
github "micheltlutz/MLVideoPlayer" ~> 1.0.0
要将 MLVideoPlayer 用作 Swift Package Manager 包,只需在您的 Package.swift 文件中添加以下内容即可。
// swift-tools-version:4.2
import PackageDescription
let package = Package(
name: "HelloMLVideoPlayer",
dependencies: [
.package(url: "https://github.com/micheltlutz/MLVideoPlayer.git", .upToNextMajor(from: "1.0.0"))
],
targets: [
.target(name: "HelloMLVideoPlayer", dependencies: ["MLVideoPlayer"])
]
)
如果您不想使用上述任何依赖管理工具,则可以手动将 MLVideoPlayer 集成到您的项目中。
cd
进入您的顶级项目目录,如果您的项目未初始化为 git 仓库,请运行以下命令$ git init
$ git submodule add https://github.com/micheltlutz/MLVideoPlayer.git
$ git submodule update --init --recursive
打开新的 MLVideoPlayer
文件夹,并将 MLVideoPlayer.xcodeproj
拖到应用程序的 Xcode 项目的项目导航器中。
它应该显示在您的应用程序的蓝色项目图标下。 它在所有其他 Xcode 组之上还是之下并不重要。
在项目导航器中选择 MLVideoPlayer.xcodeproj
并验证部署目标是否与应用程序目标匹配。
接下来,在项目导航器中选择您的应用程序项目(蓝色项目图标)以导航到目标配置窗口,然后在侧边栏中的“Targets”标题下选择应用程序目标。
在该窗口顶部的选项卡栏中,打开“General”面板。
单击“Embedded Binaries”部分下的 +
按钮。
您将看到两个不同的 MLVideoPlayer.xcodeproj
文件夹,每个文件夹都有两个不同版本的 MLVideoPlayer.framework
嵌套在 Products
文件夹中。
选择哪个
Products
文件夹并不重要。
选择 MLVideoPlayer.framework
。
就是这样!
MLVideoPlayer.framework
会自动添加为目标依赖项、链接框架和嵌入式框架,位于复制文件构建阶段,这是在模拟器和设备上构建所需的一切。
+
按钮。MLVideoPlayer.framework
。欢迎提出问题和拉取请求!
Michel Lutz @michel_lutz - 我的网站
MLVideoPlayer 在 MIT 许可下发布。 有关详细信息,请参见 LICENSE。