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
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.
Closing ticket as duplicate.