YZPlayer
YZPlayer copied to clipboard
A simple video player for iOS, based on AVPlayer, using Swift.
YZPlayer
A simple video player for iOS, based on AVPlayer. Support the vertical, horizontal screen. Support adjust volume, screen brigtness and video progress.
Update: Swift 2.2 -> Swift 3.0 -> Swift 3.1
Features
- Rotate automatically according to the screen.
- Support for horizontal and vertical play mode.
- Support play with online URL video file.
- Adjust screen brightness by slide vertical at left side of screen.
- Adjust volume by slide vertical at right side of screen.
- Slide horizontal to fast forward and rewind.
Requirements
This library requires iOS 7.0+
, Swift 3
and Xcode 8.0+
.
Usage
-
Add Key
View controller-based status bar appearance
valueNO
toinfo.plist
. -
In your ViewController, override
shouldAutorotate
.
override var shouldAutorotate : Bool {
return false
}
- Add YZPlayerView to play video.
let video = YZVideo(play_address: "https://mu.mumov.com/videogHDk7k6vxjiahC0yPRAXBN3omu", title: "旅游丨柏林的符号学")
let playerView = YZPlayerView()
playerView.video = video
playerView.delegate = self
playerView.containerController = self
self.view.addSubview(playerView)
playerView.play()
- Implements YZPlayerViewDelegate.
// click backButton
func backAction() {
// _ = navigationController?.popViewController(animated: true)
}
// click likeButton
func likeAction(isLike: Bool) {
// isLike ? print("like") : print("dislike")
}
Installation
- Download all the files in the YYPlayer subdirectory.
- Add the source files to your Xcode project.
Picture demonstration
License
YZPlayer is provided under the MIT license. See LICENSE file for details.