Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3420] iOS: Videoplayer closed before loaded still plays

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionInvalid
Resolution Date2012-05-22T20:56:56.000+0000
Affected Version/sRelease 1.6.0
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterAlan Leard
AssigneeNeeraj Gupta
Created2011-04-15T03:44:54.000+0000
Updated2017-03-09T23:00:29.000+0000

Description

Problem

If a window containing a videoplayer is on a window that is closed before the video loads, the video will still play even if it is stopped, released and/or removed.

Test Code

Paste at the bottom of default app.js

// TESTING VIDEO PLAYER
var openVideo = function () {
    var win3 = Ti.UI.createWindow();
    var videoPlayer = Ti.Media.createVideoPlayer({
        url: 'http://clips.vorwaerts-gmbh.de/VfE_html5.mp4',
        //autoplay:false
    });
    
    tab1.open(win3);
    win3.add(videoPlayer);
    
    videoPlayer.addEventListener('loadstate',function(e){
    Ti.API.info(e.loadState);
    //if(e.loadState == 1){videoPlayer.autoplay = true;}
    });
    
    win3.addEventListener('close', function () {
        Ti.API.info('Window Closed');
        videoPlayer.stop();
        videoPlayer.release();
        win3.remove(videoPlayer);
    });
    
};

win1.addEventListener('click', function () {
    openVideo();
});

As a work around, you can set autoplay to false and then turn it on when the loadstate is 1.

Ticket Reference

http://developer.appcelerator.com/helpdesk/view/76612">http://developer.appcelerator.com/helpdesk/view/76612

Comments

  1. Junaid Younus 2012-05-15

    Sample code doesn't seem to load the movie on the iOS simulator and I'm unable to open the link. Ticket closed.
  2. Lee Morris 2017-03-09

    Closing ticket as invalid.

JSON Source