Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6747] iOS: Youtube in tableview row, orientation change stops video

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionCannot Reproduce
Resolution Date2012-02-10T00:16:54.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterMike Robinson
AssigneeNeeraj Gupta
Created2011-10-21T10:24:01.000+0000
Updated2012-02-10T00:16:59.000+0000

Description

Description

Worked in previous SDKs, but now if you put a YouTube webview in a tableview row then click to start the video, then rotate the device the video stops & closes. This same behavior works fine if the webview is added directly to the window (like the KitchenSink).

Q&A Question

[Community Q&A question](http://developer.appcelerator.com/question/127163/ios-youtube-in-tableview-row-orientation-change-stops-video)

Usecase

[Usecase Example](https://gist.github.com/1304527) _Included below for convenience_ Note: Must run on device to see YouTube
Ti.UI.setBackgroundColor('#000');

var testTableView = true;
var youTubeID = 'GJ98Oezr_l4';

var win = Ti.UI.createWindow({
    title: 'Window',
    backgroundColor: '#fff',
    orientationModes: [Ti.UI.PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT]
});

if (Ti.Platform.model == 'Simulator') {
    win.add(Ti.UI.createLabel({
        text: 'Must run on device\nto see YouTube',
        font: {
            fontSize: 20,
            fontFamily: 'Helvetica Neue'
        },
        textAlign: 'center',
        width: 'auto'
    }));
}
else {
    var videoHtml = '<html><head><meta name="viewport" content="width=100, initial-scale=1.0, user-scalable=no"/></head><body style="margin:0;padding:0;">';
    videoHtml += '<div><object width="100" height="70"><param name="movie" value="http://www.youtube.com/watch?v=' + youTubeID + '"></param>';
    videoHtml += '<param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/watch?v=' + youTubeID + '" ';
    videoHtml += '" type="application/x-shockwave-flash" wmode="transparent" width="100f" height="70f"></embed></object></div></body></html>';
    
    var wvYoutube = Ti.UI.createWebView({
        width: 100,
        height: 70,
        html: videoHtml,
        scalesPageToFit: true
    });
    
    if (!testTableView) {
        win.add(Ti.UI.createLabel({
            text: 'Click to play,\nthen rotate device,\nit works!',
            font: {
                fontSize: 20,
                fontFamily: 'Helvetica Neue'
            },
            top: 2,
            height: 80,
            textAlign: 'center',
            width: 'auto'
        }));
        
        win.add(wvYoutube);
    }
    else {
        var data = [];
        
        var rowLabel = Ti.UI.createTableViewRow({
            height: 105
        });
        rowLabel.add(Ti.UI.createLabel({
            text: 'Click to play,\nthen rotate device,\nit stops and often\ndisappears!',
            font: {
                fontSize: 20,
                fontFamily: 'Helvetica Neue'
            },
            top: 2,
            height: 105,
            textAlign: 'center',
            width: 'auto'
        }));
		data.push(rowLabel);
        
        var rowYoutube = Ti.UI.createTableViewRow({
            height: 100,
            className: 'VideoRow'
        });
        rowYoutube.add(wvYoutube);
        data.push(rowYoutube);
        
        var tvYoutube = Ti.UI.createTableView({
            backgroundColor: 'white',
            rowBackgroundColor: 'transparent',
            separatorColor: '#e1e1e1',
            data: data
        });
        
        win.add(tvYoutube);
    }
}

win.open();

Comments

  1. Mike Robinson 2011-11-14

    It looks like this has since been fixed, but I am unable to close it.
  2. Mike Robinson 2011-11-29

    This issue has reappeared in the master branch. So it still needs fixing.
  3. Max Stepanov 2012-01-09

    Unable to reproduce. Tested on 4.3.5, 5.0.1 iPhones with 1.7.5, 1.8.0, 1.8.0.1, 1.9.0 SDKs
  4. Neeraj Gupta 2012-01-09

    Mike: Please let us know if this issue persists. Provide exact steps to reproduce this problem if you can reproduce it with the latest build.
  5. Neeraj Gupta 2012-01-13

    We cannot reproduce this issue with the latest builds.
  6. Thomas Huelbert 2012-01-23

    please re-open if you can reproduce.

JSON Source