Titanium.Media.createVideoPlayer - setUrl - not work in Titanium 2.1.1

You must Login before you can answer or comment on any questions.

Hello Community,

I have developed six months ago, Titanium 1.8.2 on a video app. Now I wanted to change this Titanium 2.1.1. Unfortunately, I have the problem that the change of the videos with setUrl not work anymore. I have no idea what's wrong.

My system: Mountain Lion 08.10 XCode 4.4 SDK 2.1.1

My code:

var win = Titanium.UI.createWindow();
 
        if(e.rowData.id == "fmb25ssw") {
            var videobeginn = 3;
            var videoanzahl = 14;
            var videoplay = 1;
            Titanium.UI.currentWindow.hide();
            Titanium.UI.currentWindow.hideNavBar();
        } else {
            var videobeginn = e.rowData.id;
            var videoplay = 0;
        }
 
var options = {
    contentURL: 'training/' + videobeginn + '.mp4',
    scalingMode: Titanium.Media.VIDEO_SCALING_ASPECT_FIT,
    autoplay:true,
    fullscreen:true
};
    var activeMovie = Titanium.Media.createVideoPlayer(options);                                var gone = 0;
        activeMovie.addEventListener('complete',function(e) {
            if(videoplay == 1) {
                if (videobeginn<videoanzahl && e.reason === Titanium.Media.VIDEO_FINISH_REASON_PLAYBACK_ENDED && gone == 0) {
                    videobeginn++;
                    activeMovie.setUrl('training/' + videobeginn + '.mp4');
                    gone = 1;
                } else {
                    videoplay = 0;
                    Titanium.UI.currentWindow.show();
                    Titanium.UI.currentWindow.showNavBar();
                    win.close();
                }
            }
        });

1 Answer

Accepted Answer

Using the setMedia() method haven't had any problems with download files playing, nor with streamed m3u8 files on 2.1.1

— answered 10 months ago by Stephen Feather
answer permalink
2 Comments
  • We also stop the currently playing video before changing urls.

    — commented 10 months ago by Stephen Feather

  • a perfect! the fail was i must stop() the video -> then change the setUrl or setMedia -> then start()

    In Ti 1.8.2 was that on the fly :(

    Big thanks!

    — commented 10 months ago by Jonathan Schneider

Your Answer

Think you can help? Login to answer this question!