Video player disappear
Hi.
I have a video player at window 1 and the event listener for video player is to open a new window to play the video. But after finish playing at the new window, the video player at window 1 will give me nothing(cannot see the video player).
Here is my code for window 1:
var videoView = Titanium.UI.createView({
//backgroundColor:'white',
top:280,
width:300,
left: 20,
right: 20,
height: 180,
opacity : 1,
borderWidth: 0
});
var player = Titanium.Media.createVideoPlayer({
url:'../video/movie.mp4',
//backgroundColor: 'white',
movieControlMode:Titanium.Media.VIDEO_CONTROL_NONE,
scalingMode:Titanium.Media.VIDEO_SCALING_ASPECT_FIT
});
videoView.add(player);
player.stop();
player.addEventListener('click',function()
{
if (player.playing) {
player.stop();
var w = Ti.UI.createWindow({
url: '../MTE/video.js',
backgroundColor: 'white',
title: titleLabel.text
});
Titanium.UI.currentTab.open(w);
}
else if(player.stop)
{
w = Ti.UI.createWindow({
url: '../MTE/video.js',
backgroundColor: 'white',
title: titleLabel.text
});
Titanium.UI.currentTab.open(w);
}
code for new window:
var win = Ti.UI.currentWindow;
win.orientationModes = [
Titanium.UI.LANDSCAPE_LEFT,
Titanium.UI.LANDSCAPE_RIGHT
];
var player = Titanium.Media.createVideoPlayer({
url:'../video/movie.mp4',
backgroundColor: 'white',
width:480,
height:250,
movieControlMode:Titanium.Media.VIDEO_CONTROL_DEFAULT,
scalingMode:Titanium.Media.VIDEO_SCALING_ASPECT_FIT
});
player.addEventListener('complete',function(e){
win.close();
});
player.stop();
win.add(player);
Anyone can help me?
Thank you!
1 Answer
-
I had this problem up until awhile ago. I believe it is your Event Listeners. The only (major) difference between yours and my code is that I have this:
win.addEventListener('close', function() { activeMovie.stop(); });
Hope that helps? I know, I ain't that great at helping :P