/VideoPlayer

AVPlayer control and monitoring made easy (with Rx)

Primary LanguageSwift

VideoPlayer

Xcode Swift

AVPlayer control made easy.

design

VideoPlayer
- VideoPlayerControl
- VideoPlayerMonitor

Features (Including Example only features)

work in progress

  • Play/Pause/Seek
  • Background Playback
  • Background AirPlay
  • Built-in player MonitorView for debugging
  • allows recording or not (defaults to no)
  • fundamental player state observables (e.g. rate, periodicTime, duration..)
  • Timed Metadata (MPEG2 transport stream only)
  • any loading state observable

Demo code in Example.app

  • In-Playlist Timed Metadata
  • Cross-viewcontroller AirPlay (will be in Example soon)
  • Picture-in-Picture (will be in Example soon)

Usage

Initializing AVPlayer

Observe VideoPlayer.player: Single<AVPlayer> to get AVPlayer instance.

See: Example

Monitor and Control state

Do not write player?.pause() any more.

See: Example

Encrypted contents

VideoPlayerFactory initializer accepts AVAssetResourceLoaderDelegate. Set your instance which handles EXT-X-KEY methods.

Handling Errors

TBD

See: Example

Testing

See: VideoPlayerTests

You can simulate player behavior by yourself to improve test coverage of your app.

Build Example

  1. Make sure your default xcode-select -p points at correct Xcode version. (Currently Xcode10.1)

  2. Run following

    carthage bootstrap --platform iOS
    xcodegen
    
  3. Open Example.xcodeproj

License

MIT