[TIMOB-11212] iOS: VideoPlayer goes into a loading mode at the end of the video when created in a two window app
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2012-10-10T17:47:13.000+0000 |
Affected Version/s | Release 2.1.3 |
Fix Version/s | 2012 Sprint 21 API, 2012 Sprint 21 |
Components | iOS |
Labels | api |
Reporter | Nikhil Sharma |
Assignee | Vishal Duggal |
Created | 2012-09-28T21:17:16.000+0000 |
Updated | 2013-04-15T22:39:00.000+0000 |
Description
Video player goes into a loading mode at the end of the video when created in a two window application. It works fine in a single window app.
Repo Steps
1. Run the below code in your projects app.js. 2. Open the app. Click in the button "Go to second window". 3. Now click the button "Play video" 4. Go to the end of the video and you can see the loading window after the video ends.
function movie_remote(target) {
var contentURL = 'http://movies.apple.com/media/us/ipad/2010/tours/apple-ipad-video-us-20100127_r848-9cie.mov';
if (Ti.Platform.name == 'android') {
contentURL = "http://dts.podtrac.com/redirect.mp4/twit.cachefly.net/video/aaa/aaa0033/aaa0033_h264b_640x368_256.mp4";
}
var activeMovie = Titanium.Media.createVideoPlayer({
url: contentURL,
backgroundColor:'#111',
mediaControlStyle:Titanium.Media.VIDEO_CONTROL_FULLSCREEN, // See TIMOB-2802, which may change this property name
scalingMode:Titanium.Media.VIDEO_SCALING_ASPECT_FIT,
fullscreen: true
});
var windowClosed = false;
activeMovie.addEventListener('complete',function() {
Ti.API.info('moview complete');
if(!windowClosed) {
windowClosed = true;
Ti.UI.iPhone.showStatusBar();
activeMovie.stop();
target.remove(activeMovie);
target.navBarHidden = false;
target.orientationModes = [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT, Ti.UI.UPSIDE_PORTRAIT, Ti.UI.PORTRAIT];
target.close();
}
});
target.navBarHidden = true;
target.orientationModes = [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT];
target.add(activeMovie);
activeMovie.play();
};
function Window1(tab){
var win = Ti.UI.createWindow({
backgroundColor: '#fff',
tabBarHidden: true,
title: 'L1'
});
var btn = Ti.UI.createButton({
title: 'GO TO SECOND WINDOW'
});
btn.addEventListener('click', function() {
tab.open(Window2());
});
win.add(btn);
win.addEventListener('open', function() {
win.orientationModes = [Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT, Ti.UI.UPSIDE_PORTRAIT, Ti.UI.PORTRAIT];
});
return win;
}
function Window2(){
var win = Ti.UI.createWindow({
backgroundColor: '#ccc',
title: 'L2'
});
var btn = Ti.UI.createButton({
title: 'Play Video'
});
win.add(btn);
btn.addEventListener('click', function() {
movie_remote(win);
});
return win;
}
function TabGroup() {
var tabgroup = Ti.UI.createTabGroup();
var tab = Ti.UI.createTab();
var win = Window1(tab);
tab.window = win;
tabgroup.addTab(tab);
return tabgroup;
}
TabGroup().open();
This is a really annoying bug. Does anyone have a workaround?
A fullscreen video player comes up in its own view controller that is presented by the top window. Before removing the video player from the window or closing the current window it is important to dismiss this full screen movie controller. Add activeMovie.setFullscreen(false); in the complete handler before removing video player and everything will work fine.