Skip to content

Commit

Permalink
Merge pull request sahin#101 from mobileplayer/fix/postroll-dismiss
Browse files Browse the repository at this point in the history
[MobilePlayerViewController] Dismiss postroll when playback starts
  • Loading branch information
isair committed Dec 10, 2015
2 parents d6355c2 + ae3429c commit 0fd5abf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions MobilePlayer/MobilePlayerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ public class MobilePlayerViewController: MPMoviePlayerViewController {
userInfo: [MobilePlayerErrorUserInfoKey: error])
}
if let postrollVC = self.postrollViewController {
self.prerollViewController?.dismiss()
self.pauseOverlayViewController?.dismiss()
self.showOverlayViewController(postrollVC)
}
}
Expand Down Expand Up @@ -284,11 +286,16 @@ public class MobilePlayerViewController: MPMoviePlayerViewController {
}

/// Initiates playback of current content.
///
/// Starting playback causes dismiss to be called on prerollViewController, pauseOverlayViewController
/// and postrollViewController.
public func play() {
moviePlayer.play()
}

/// Pauses playback of current content.
///
/// Pausing playback causes pauseOverlayViewController to be shown.
public func pause() {
moviePlayer.pause()
}
Expand Down Expand Up @@ -537,6 +544,7 @@ public class MobilePlayerViewController: MPMoviePlayerViewController {
}
prerollViewController?.dismiss()
pauseOverlayViewController?.dismiss()
postrollViewController?.dismiss()
} else {
playButton?.toggled = false
hideControlsTimer?.invalidate()
Expand Down

0 comments on commit 0fd5abf

Please sign in to comment.