Skip to content
A video player for SwiftUI πŸŽ‰
Swift
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Demo feat(*): Start play Jul 21, 2019
Images
Sources/VideoPlayer Fix xcode beta4 error Aug 4, 2019
Tests Initial commit Jul 14, 2019
.gitignore Update .gitignore Jul 14, 2019
LICENSE Initial commit Jul 14, 2019
Package.swift Make Swift Package Manager set correct Aug 4, 2019
README.md

README.md

VideoPlayer

Features

  • Plays local media or streams remote media over HTTP.
  • Cache video data at playing.
  • Customizable UI and user interaction.
  • No size restrictions.
  • Simple API.

TODO

  • Orientation change support.
  • Seek time support.
  • More complex demo.

Requirements

  • iOS 13+
  • Xcode 11+
  • Swift 5+

Installation

Swift Package Manager

  1. Select Xcode -> File -> Swift Packages -> Add Package Dependency...
  2. Enter https://github.com/wxxsw/VideoPlayer.
  3. Click Next, then select the version, complete.

Usage

struct ContentView : View {
    @State var isAutoReplay: Bool = true
    @State var isPlay: Bool = true
    @State var isMute: Bool = false
    
    let videoURL: URL
    
    var body: some View {
        VideoPlayerView(url: .constant(videoURL), isPlay: $isPlay)
            .autoReplay($isAutoReplay)
            .mute($isMute)
            .onPlayToEndTime { print("Play to the end time.") }
            .onReplay { print("Replay after playing to the end.") }
            .onStateChanged { _ in print("Playback status changes, such as from play to pause.") }
    }
}

Thanks

Banner Design by @aduqin

License

VideoPlayer is released under the MIT license. See LICENSE for details.

You can’t perform that action at this time.