Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9331] iOS: Videos in a ScrollableView stop working when moving back and forth in the views

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionDuplicate
Resolution Date2012-07-11T15:35:44.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sn/a
ComponentsiOS
Labelsapi
ReporterDavide Cassenti
AssigneeNeeraj Gupta
Created2012-05-31T12:31:40.000+0000
Updated2017-03-09T21:28:48.000+0000

Description

Problem description

Issues displaying the video while moving back and forth the scrollableView.

Steps to reproduce

1. Create an app with the code below 2. Open the app and scroll to the right 2-3 times: in each page, a view is displayed 3. Go back to a previous video by scrolling to the left: the videos disappear and the screen goes black
var win1 = Titanium.UI.createWindow({ 
    backgroundColor:'white',
    orientationModes:[Ti.UI.PORTRAIT,Ti.UI.LANDSCAPE_LEFT,Ti.UI.LANDSCAPE_RIGHT]
});

var videoParams = {
  mediaControlStyle: Titanium.Media.VIDEO_CONTROL_EMBEDDED,
  scalingMode: Ti.Media.VIDEO_SCALING_ASPECT_FIT,
  height: '72%',
  autoplay:false
};

var videoViews = [];

var curVideo = null;

for(var i=0; i<20; i++){
  videoViews.push(Ti.Media.createVideoPlayer(videoParams));
}

var scrollableView = Ti.UI.createScrollableView({
  views: videoViews,
  showPagingControl: true
});

scrollableView.addEventListener('scroll', function(e){
    if (curVideo)
    {
        if (curVideo == videoViews[e.currentPage])
        {
            return;
        }
        curVideo.pause();
    }
    curVideo = videoViews[e.currentPage];
    curVideo.url = 'movie.mp4';
});

win1.add(scrollableView);

win1.open();

Expected result

Videos are displayed correctly

Comments

  1. Vishal Duggal 2012-07-11

    Duplicate of TIMOB-8493. A solution has been posted in the ticket. See the last sample code posted. FYI you can not have more than one videoPlayer active at a time.
  2. Lee Morris 2017-03-09

    Closing ticket as duplicate.

JSON Source