동영상에서 인터페이스 요소 재정의

SDK를 통해 시스템과 상호작용하기 위한 인터페이스 요소를 재정의할 수 있습니다. 특히 여기에는 다음에 대한 요소가 포함됩니다.

  • 동영상 진행 제어(VideoProgress);
  • 동영상 소리 켜기/끄기(디자인 및 위치 변경).

1. 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. 소리 켜기/끄기 버튼 재정의

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. 제어가 있는 객체 생성 및 연결

  1. 재정의가 완료되면 객체를 생성하세요.

    let customVideoPlaybackControls = NativeVideoPlaybackControls(
        CustomVideoProgressControl(),
        CustomVideoPlaybackMuteControl()
    )
    
  2. 객체를 YMANativeMediaView에 연결하세요.

    customVideoPlaybackControls.setupVideoPlaybackControls(to: YMANativeMediaView)