Redefining interface elements in a video

The SDK enables you to redefine interface elements for interacting with the system. In particular, this includes the elements for:

  • Controlling video progress (VideoProgress);
  • Enabling/disabling video sound (changing design and position).

1. Redefining VideoProgress

class CustomVideoProgressControl: UIProgressView, NativeVideoPlaybackProgressControl {

    /// Configures a progress control with position and duration.
    /// - Parameters:
    ///   - position: Position of current OutStream ad.
    ///   - duration: Duration of current OutStream ad.
    func configure(withPosition position: TimeInterval, duration: TimeInterval) {
    }

    /// Resets a video progress.
    func reset() {
    }
}

2. Redefining the sound on/off button

class CustomVideoPlaybackMuteControl: UIButton, NativeVideoPlaybackMuteControl {
    /// Delegate is notified about video playback mute control events.
    var delegate: NativeVideoPlaybackMuteControlDelegate?

    /// Configures a mute control with specified isMuted flag.
    /// - Parameter isMuted: Flag for setting mute/unmute state.
    func configure(withIsMuted isMuted: Bool) {
    }

    /// Configures a mute control with specified isHidden flag.
    /// - Parameter isHidden: Flag for setting mute/unmute state.
    func configure(withIsHidden isHidden: Bool) {
    }
}

3. Creating and linking an object with controls

  1. Once you are done with redefinition, create an object.

    let customVideoPlaybackControls = NativeVideoPlaybackControls(
        CustomVideoProgressControl(),
        CustomVideoPlaybackMuteControl()
    )
    
  2. Link the object to YMANativeMediaView.

    customVideoPlaybackControls.setupVideoPlaybackControls(to: YMANativeMediaView)