[TIMOB-12156] iOS: In iOS6, Modal Window with video player in it leaves a black screen on close
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Hold |
Resolution Date | 2017-03-21T21:15:15.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | 2013 Sprint 08 API, 2013 Sprint 08 |
Components | iOS |
Labels | ios6, videoplayer |
Reporter | Anirudh Nagesh |
Assignee | Vishal Duggal |
Created | 2012-12-27T02:40:54.000+0000 |
Updated | 2017-03-21T21:15:20.000+0000 |
Description
Modal window with a video player inside it does not close properly and leaves a black screen on completion of video. It happens only on iOS6. On iOS5, works as expected. Window closes properly and returns to the root window.
Run the below code to see the behavior.
var rootwin = Ti.UI.createWindow({
backgroundColor : 'red',
navBarHidden : true,
top : 0,
left : 0,
right : 0,
bottom : 0
});
var button = Ti.UI.createButton({
title : 'Play Video',
width : '250dp',
height : '50dp'
});
button.addEventListener('click', function(e){
var win = Ti.UI.createWindow({
navBarHidden : true,
backgroundColor : '#ffffff',
exitOnClose : true,
top : 0,
left : 0,
right : 0,
bottom : 0,
orientationModes:[Ti.UI.PORTRAIT,Ti.UI.LANDSCAPE_LEFT,Ti.UI.LANDSCAPE_RIGHT],
modal : true // comment this line to see proper behavior
});
var videoPlayer = Titanium.Media.createVideoPlayer({
repeatMode : Ti.Media.VIDEO_REPEAT_MODE_NONE,
url : 'http://monactifry-tevolys.seb-cms-qual.bearstech.com/videos/9789.mp4',
backgroundColor : 'black',
mediaControlStyle : Titanium.Media.VIDEO_CONTROL_DEFAULT,
scalingMode : Titanium.Media.VIDEO_SCALING_ASPECT_FIT,
fullscreen : true,
autoplay : true
});
function onComplete() {
videoPlayer.stop();
win.close();
}
function onFullScreen(e) {
if (e.entering == 0) {
videoPlayer.stop();
win.close();
}
}
videoPlayer.addEventListener('complete', onComplete);
videoPlayer.addEventListener('fullscreen', onFullScreen);
win.add(videoPlayer);
win.open();
});
rootwin.add(button);
rootwin.open();
Note: Opening just a modal window( without video player ) from root window works fine and expected.
I've been having this same problem but didn't know it had anything to do with a videoplayer being inside the window. My problem has the exact same behavior yet is a bit different. It only happens when i open a modal window from a tableview, then return to a previous view in the navigationgroup, when i return to the window with the tableview, its appears as if the click on the table is trying to open the Modal window twice. This may or may not be directly related to this error, but it only happens when changing to SDK 3.0.0.GA, if i take the exact same code and run it with 2.1.4.GA it works just fine.
Nothing on this yet?
Verified occurs with: SDK: 3.0.2.GA SDK: 3.1.0.v20130312161655 Titanium Studio, build: 3.0.2.201302191606 The "onComplete" function is executed, but the win.close(); event doesn't have any effect. Additional note: If you tap the screen during play and hit the "done" button, you get this in the log: [WARN] : ing: Attempt to dismiss from view controller
The blank screen on complete on iOS6 has been reported in TIMOB-11212 and a workaround has been provided. However using that workaround will still not work in this case since you are trying to close the window while it is dismissing its presented fullscreen video player Using this code will solve the issue and work consistently across various iOS versions.
Going to resolve this as HOLD. This should be revisited on iOS 4.X deprecation. JS workaround in ticket
Closing ticket due to the time that has passed since it was filed and iOS 4 has been deprecated.