Skip to content

Latest commit

 

History

History
84 lines (54 loc) · 2.38 KB

README.md

File metadata and controls

84 lines (54 loc) · 2.38 KB

YZPlayer

License MIT  Platform  Support 

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

Demo

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

  1. Add Key View controller-based status bar appearance value NO to info.plist.

  2. In your ViewController, override shouldAutorotate.

override var shouldAutorotate : Bool {
    return false
}
  1. 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()
  1. Implements YZPlayerViewDelegate.
// click backButton
func backAction() {
    // _ = navigationController?.popViewController(animated: true)
}

// click likeButton
func likeAction(isLike: Bool) {
    // isLike ? print("like") : print("dislike")
}

Installation

  1. Download all the files in the YYPlayer subdirectory.
  2. Add the source files to your Xcode project.

Picture demonstration

Demo1 Demo2 Demo3

License

YZPlayer is provided under the MIT license. See LICENSE file for details.