I am working at an Android app in Titanium. At a certain screen I must play a video from a link. It takes some time for charging so I must put a ProgressDialog until the video starts. I tried to use ActivityIndicator for this, like this :
var activeMovie = Titanium.Media.createVideoPlayer({
backgroundColor:'#000',
fullscreen:true
});
var dialog = Titanium.UI.createActivityIndicator();
dialog.message = 'Loading...';
win.add(dialog);
dialog.show();
activeMovie.setUrl(url);
activeMovie.mediaControlStyle=Titanium.Media.VIDEO_CONTROL_FULLSCREEN;
activeMovie.addEventListener("preload", function(e){
dialog.show() ;
});
activeMovie.addEventListener('load', function(e){
dialog.hide() ;
});
activeMovie.addEventListener('complete', function(e){
activeMovie.stop();
navController.close();
});
This code make appear the ProgressDialog for 2 seconds and then disappear. After this time I get a black screen for a time (the video is charging) and after this time video starts. Can anyone help me where is my mistake?
One solution to your problem might be :