IOS 16: Default video controls missing
justingreerbbi opened this issue · 1 comments
I have searched and made sure there are no existing issues for the issue I am filing
- I have searched the existing issues
Description
When creating a video player using a local or remote source, the controls seem to be missing.
IOS 16 introduced a new UX with video and while the Apple docs say that nothing else needs to happen on the developer side, it looks like there are indeed changes that need to be made.
An example of this issue with a possible fix can be found at https://stackoverflow.com/questions/72830620/playback-buttons-do-not-appear-in-an-avplayer-after-adding-a-layer-ios-16.
It looks like the player controller needs to be added as a child to the parent before assigning the subview.
I am very new at the Ti Framework and have been attempting to patch this myself but I am lacking the experience for the framework currently to make the change.
Expected Behavior
IOS 16 video player will display the IOS default UI when the video is tapped and scrubbed.
Actual behavior
When the video player is tapped, no controls are displayed however the video event still works as expected.
Reproducible sample
var vidWin = Titanium.UI.createWindow({
title: 'Video View Demo',
backgroundColor: '#fff'
});
var videoPlayer = Titanium.Media.createVideoPlayer({
top: 2,
autoplay: true,
backgroundColor: 'blue',
height: 300,
width: 300,
mediaControlStyle: Titanium.Media.VIDEO_CONTROL_DEFAULT,
scalingMode: Titanium.Media.VIDEO_SCALING_RESIZE_ASPECT
});
videoPlayer.url = 'movie.mp4';
vidWin.add(videoPlayer);
vidWin.open();
Steps to reproduce
Create a video player and once playing, tap the video to show controls.
Platform
iOS
SDK version you are using
11.1.1
Alloy version you are using
No response
It worked fine for me (tested with iOS 17 simulator), so it seems like they might fix it between iOS 16 and 17?
If you are looking for an iOS 16 solution, can you try this diff?
--- a/iphone/Classes/TiMediaVideoPlayerProxy.m
+++ b/iphone/Classes/TiMediaVideoPlayerProxy.m
@@ -166,6 +166,11 @@ - (void)viewWillAttach
reallyAttached = YES;
}
+- (void)viewDidAttach
+{
+ [TiApp.controller.topPresentedController addChildViewController:movie];
+}
+
- (void)viewDidDetach
{
[self removeNotificationObserver];
@@ -175,6 +180,7 @@ - (void)viewDidDetach
[movie setPlayer:nil];
RELEASE_TO_NIL(movie);
reallyAttached = NO;
+ [movie removeFromParentViewController];
}
- (void)windowWillClose