Swiftpack.co - SergioEstevao/SVEVideoPlayerView as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by SergioEstevao.
SergioEstevao/SVEVideoPlayerView 0.3.0
A video player view implemented in Swift
⭐️ 0
🕓 4 years ago
iOS
.package(url: "https://github.com/SergioEstevao/SVEVideoPlayerView.git", from: "0.3.0")

SVEVideoPlayerView

SVEViewPlayerView is an iOS view that diplays videos.

Screenshot

Installation

SVEViewPlayerView is available through Swift Package Manager. To install it, simply add the following line to your Package.swit:

dependencies: [
    .package(url: "https://github.com/SergioEstevao/SVEVideoPlayerView.git", from: "0.1")
]

Usage

To use the video player do the following:

Import header

import SVEVideoPlayerView

Create and present the view

let videoURL = Bundle.main.url(forResource: "video", withExtension: "mp4")
let videoView = VideoPlayerView(videoURL: videoURL)
view.addSubview(videoView)
videoView.play()

Get notified about video events

You can set a delegate to the video view to get notified of the end of play and error situations.

videoURL.delegate = self
...
func videoPlayerView(playerView: VideoPlayerView, didFailWithError error: Error) {
    print("Error: \(error)\n")
}

func videoPlayerViewStarted(playerView: VideoPlayerView) {
    print("Started\n")
}

func videoPlayerViewFinish(playerView: VideoPlayerView) {
    print("Finish\n")    
}

How to present the video control toolbar

videoView.showsPlayBackControls = true

Sample Project

To run the example project, clone the repo, and open the SVEVideoPlayerView.xcproject file

Requirements

  • AVFoundation
  • XCode 11 or above
  • iOS 11 or above

Getting in Touch

If you have questions about getting setup or just want to say hi, just drop an issue on Github with your request.

Author

Sérgio Estêvão

License

SVEVideoPlayerView is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 0
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics