Alex
Alex

Reputation: 5278

Player-swift library, how to adjust playback rate

I am using the Player library https://github.com/piemonte/Player for video playback in my app.

I'm trying to figure out how to add the functionality to change the playback speed/rate of the video, like this: https://developer.apple.com/reference/avfoundation/avplayer/1388846-rate

I didn't see a playback function to allow this type of direct control in the Player docs.

Is there a way to change the "rate" of the underlying AVPlayer?

Upvotes: 1

Views: 847

Answers (1)

Emmanouil Nicolas
Emmanouil Nicolas

Reputation: 134

In this lib have the Player.swift, there you can access "_avplayer" variable that is a AVPlayer object..

You can make _avplayer public and access it from everywhere, or you can just make a getter and setter like:

open var rate: Float {
    get {
        return self._avplayer.rate
    }
    set {
        self._avplayer.rate = newValue
    }
}

Upvotes: 1

Related Questions