Merge branch 'mkirk/ensure-video-stopped-2'

pull/1/head
Michael Kirk 7 years ago
commit 5fdadf5bde

@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)playVideo; - (void)playVideo;
// Stops playback and rewinds // Stops playback and rewinds
- (void)stopVideo; - (void)stopAnyVideo;
- (void)setShouldHideToolbars:(BOOL)shouldHideToolbars; - (void)setShouldHideToolbars:(BOOL)shouldHideToolbars;
- (void)zoomOutAnimated:(BOOL)isAnimated; - (void)zoomOutAnimated:(BOOL)isAnimated;

@ -81,7 +81,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)dealloc - (void)dealloc
{ {
[self stopVideo]; [self stopAnyVideo];
} }
- (instancetype)initWithGalleryItemBox:(GalleryItemBox *)galleryItemBox - (instancetype)initWithGalleryItemBox:(GalleryItemBox *)galleryItemBox
@ -576,6 +576,13 @@ NS_ASSUME_NONNULL_BEGIN
[self.delegate mediaDetailViewController:self isPlayingVideo:NO]; [self.delegate mediaDetailViewController:self isPlayingVideo:NO];
} }
- (void)stopAnyVideo
{
if (self.isVideo) {
[self stopVideo];
}
}
- (void)stopVideo - (void)stopVideo
{ {
OWSAssert(self.isVideo); OWSAssert(self.isVideo);

@ -190,7 +190,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
public func didPressAllMediaButton(sender: Any) { public func didPressAllMediaButton(sender: Any) {
Logger.debug("\(logTag) in \(#function)") Logger.debug("\(logTag) in \(#function)")
currentViewController.stopVideo() currentViewController.stopAnyVideo()
guard let mediaGalleryDataSource = self.mediaGalleryDataSource else { guard let mediaGalleryDataSource = self.mediaGalleryDataSource else {
owsFail("\(logTag) in \(#function) mediaGalleryDataSource was unexpectedly nil") owsFail("\(logTag) in \(#function) mediaGalleryDataSource was unexpectedly nil")
@ -335,10 +335,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
// Do any cleanup for the no-longer visible view controller // Do any cleanup for the no-longer visible view controller
if transitionCompleted { if transitionCompleted {
previousPage.zoomOut(animated: false) previousPage.zoomOut(animated: false)
previousPage.stopAnyVideo()
if previousPage.galleryItem.isVideo {
previousPage.stopVideo()
}
updateFooterBarButtonItems(isPlayingVideo: false) updateFooterBarButtonItems(isPlayingVideo: false)
} }
} }

Loading…
Cancel
Save