Skip to content

Latest commit

 

History

History
34 lines (28 loc) · 900 Bytes

README.md

File metadata and controls

34 lines (28 loc) · 900 Bytes

AVPlayerController plugin: detects Pause/Play/End Video

This is an example of AVPlayerController plugin to get notifications when people pause/resum/end Video without a custom layer.

Install

You will need to copy

Plugin/Plugin/ControlPlugin.swift

into your project

Use it

First of all you will have to instance it in your Controller

var controlPlugin = ControlPlugin()

after that, once you have your AVPlayer, you need to use

self.controlPlugin.addObserver(player: self.player)

To set the ''rate'' and ''playerDidFinishPlaying'' observers.
And thats all... this plugin will show you on console a message when:

  • Video ends
  • User Play
  • User Pause
  • △ Paused Time

Also you can recibe a String with all this information using the following function:

var finalmessage = controlPlugin.end()

IMPORTANT TO WORK CORRECTLY, THE VIDEO MUST START PLAYING