Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10526] Android: Video created with object tag inside a webview does not automatically stop when the window/app is closed

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionHold
Resolution Date2013-03-07T00:16:17.000+0000
Affected Version/sRelease 2.1.1
Fix Version/s2013 Sprint 05 API, 2013 Sprint 05
ComponentsAndroid
LabelsSupportTeam, api
ReporterNikhil Sharma
AssigneeVishal Duggal
Created2012-08-21T11:18:33.000+0000
Updated2013-03-27T22:56:28.000+0000

Description

When you create a video in a webview with object tag (HTML5), the video doesn't automatically stop when the window/app is closed.

Repo Steps

1. Run the below code in app.js 2. Click back button and you can still hear the video playing in the background.
(function() {
    var window = Titanium.UI.createWindow({
        left : Titanium.Platform.displayCaps.platformWidth,
        backgroundColor : '#787878',
        navBarHidden : true,
        opacity : 0.0,
        layout : 'absolute'
    });
    var webView = Titanium.UI.createWebView({
        top : 0,
        scalesPageToFit : true,
        left : 0,
        width :'100%',
        showScrollbars : false,
        willHandleTouches : false,
        disableBounce: false,
        pluginState: Titanium.UI.Android.WEBVIEW_PLUGINS_ON
    });
    var html = 
    '<html>' + 
        '<head>' +
           '<meta name="viewport" content="width=device-width,user-scalable=yes,initial-scale=1">' +
        '</head>' + 
        '<body>' +
          '<P>Video 1</P><P><div class="video_callout" style="width:330px;height:275px;">'+
          '<script language="JavaScript" type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>'+


          '<object id="myExperience1301289234001" class="BrightcoveExperience">'+
           '<param name="bgcolor" value="white" />' +
           '<param name="width" value="480" />' +
           '<param name="height" value="270" />' +
           '<param name="playerID" value="1052840410001" />' +
           '<param name="playerKey" value="AQ~~,AAAABokGock~,bQUst1ZshUkZ7AWyIRKjmoefLfGQUFYx" />' +
           '<param name="isVid" value="true" />' +
           '<param name="isUI" value="true" />' +
           '<param name="dynamicStreaming" value="true" />' +
           '<param name="@videoPlayer" value="1301289234001" />' +
          '</object>' +

          '<script type="text/javascript">brightcove.createExperiences();</script>' +


         '</body>' + 
      '</html>';
   webView.html = html;
   window.add(webView);
   window.addEventListener('close',function(){
   Ti.API.info('window closing');
});
   window.open();
})();

Comments

  1. Vivekr 2013-01-30

    in progress
  2. Vishal Duggal 2013-03-07

    The only workaround I have found is to change the page in the webview before closing the window. The problem and the workaround are all over the web. Something like this
          window.addEventListener('androidback',function(){
             Ti.API.info('GOT ANDROID BACK');
             webView.url = "data://";
             setTimeout(function(){window.close()},250);
          })
       
    Going to mark this ticket as HOLD because we should ideally fix it in code. However triage of this bug has exposed a bunch

JSON Source