[TIMOB-6210] Android: Video Player view plays video when app comes to foreground from background, even if it was paused when backgrounded
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-01-05T13:31:34.000+0000 |
Affected Version/s | Release 1.8.0.1 |
Fix Version/s | Sprint 2011-46, Release 1.8.0.1 |
Components | Android |
Labels | module_media, qe-testadded |
Reporter | Bill Dawson |
Assignee | Bill Dawson |
Created | 2011-11-16T21:16:50.000+0000 |
Updated | 2012-01-30T10:21:53.000+0000 |
Description
Reproduce:
* Create an app with the app.js from below.
* Start the app.
* When you see "video ready", tap the window to show the controls (if they're not showing) and press play.
* Play the video for a few seconds, then pause it.
* Hit your home button to background the app.
* Go back to the app and wait a few seconds. It will start playing again.
Expected Behavior:
When coming back to the app, the video should just load and then "seek" to the last played location, but not actually start playing.
/*global Ti, Titanium, alert, JSON, require, setTimeout, setInterval */
Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({
title:'Test',
backgroundColor:'green',
exitOnClose: true
});
var vp, lbl;
win.add( vp = Ti.Media.createVideoPlayer({
url:'http://dts.podtrac.com/redirect.mp4/twit.cachefly.net/video/aaa/aaa0033/aaa0033_h264b_640x368_256.mp4',
movieControlMode: Titanium.Media.VIDEO_CONTROL_EMBEDDED,
scalingMode:Titanium.Media.VIDEO_SCALING_MODE_FILL,
autoplay:false,
top:0,
bottom: "200dp",
left: "50dp", right: "50dp",
backgroundColor: "blue"
}));
win.add( lbl = Ti.UI.createLabel({
text: "wait...",
bottom: "10dp",
height: "auto",
left: 0, right: 0,
textAlign: "center",
color: "white",
backgroundColor: "black",
font: {fontSize: 25}
}));
vp.addEventListener("loadstate", function(e) {
if (e.loadState === Ti.Media.VIDEO_LOAD_STATE_PLAYABLE) {
lbl.text = "video ready";
}
});
vp.addEventListener("playbackState", function() {lbl.text = "";});
var resumeCount = 0;
win.open();
Pull request ready. https://github.com/appcelerator/titanium_mobile/pull/724
Bug fixed. Verified on: SDK: 1.8.0.1.v20111206154658 Runtimes: Android V8/Rhino Studio: 1.0.7.201112052104 OS: OS X Lion Devices Tested: Nexus One 2.2.2, Droid3 2.3.4, G-Slate 3.1, Emulator 4.0
Reopening for label updates