[AC-2491] Android: Fullscreen video playback restarts when screen is rotated (orientation changes)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2014-07-14T21:05:20.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Jeremy Waite |
Assignee | Mauro Parra-Miranda |
Created | 2013-08-17T03:25:18.000+0000 |
Updated | 2016-03-08T07:41:32.000+0000 |
Description
When playing a video (mp4) fullscreen using the code below:
var videoPlayer = Titanium.Media.createVideoPlayer({
url:Alloy.CFG.introVideo,
autoplay:true,
fullscreen:true,
mediaControlStyle: Titanium.Media.VIDEO_CONTROL_DEFAULT,
scalingMode : Titanium.Media.VIDEO_SCALING_ASPECT_FIT
});
the video starts playing in portrait mode, but when you rotate the device the video playback restarts and the video replayed from the beginning.
Hello Jeremy Waite, Is it for Alloy or Titanium? I tested this for Both Alloy and Titanium. I can't reproduce this. Test Environment: Titanium SDK version: 3.1.2 (08/14/13 12:45 5ceaff8) OS: OS X 10.8.4 IOS Simulator Version 6.0 (369.2) Android SDK: 2.3.3 Thanks
I have the same issue on Android, using the code below. Note, tested on ios device running ios 7.0.4 and do NOT have the issue, video continues playing seamlessly when devices is rotated. var Video = Ti.Media.createVideoPlayer({ url: VideoURL, //This is a URL to a streaming mp4 video file (or http live streaming video file on ios) fullscreen: true, autoplay: true, backgroundColor: '#000', mediaControlStyle: Ti.Media.VIDEO_CONTROL_DEFAULT, scalingMode: Ti.Media.VIDEO_SCALING_ASPECT_FIT }); Environment: Application: Titanium (NOT alloy) Titanium SDK Version: 3.1.3 OS: OSX 10.8.5 Android SDK: 4.0 (API 14)
[~jawaite123@yahoo.com] [~bradleycorn] We tested this issue with the test code below. We were not able to reproduce this issue in Ti SDK 3.1.3.GA. Please test this issue using the latest release and let us know your feedback. H5. Testing Environment: Ti CLI 3.1.2 Titanium SDK: 3.1.3 and later Android Device
Test Case
Steps to Reproduce:
Create a simple project.
Update this code in app.js
Run this with testing environment
Rotate android device randomly
Video will be play continues without any restart
ThanksI have some additional feedback on this issue. I created an empty test project following the instructions above and put the following in the app.js:
the video plays back perfectly on my devices. When I rotate the device, the video continues to play seamlessly. I then updated the
Now when I run the app on my devices, the error appears. Rotating the device causes the video to restart from the beginning.
This issue can be reproduced with Android SDK version 2.2 (API level 8). But the minimum Android version supported by Titanium SDK is 2.3.3 (API level 10) and the provided test case works fine with Android SDK 2.3.3. Resolving this ticket invalid as API level 8 is unsupported. Please refer to the compatibility matrix in the documentation for more information: http://docs.appcelerator.com/titanium/latest/#!/guide/Titanium_Compatibility_Matrix
I am still seeing this issue, despite udpating the API level in the android manifest. Using the same code as my previous comment above, but changing the android manifest to only support a minimum api level of 11, the bug is still there, the video restarts when rotated. Here is my new manifest entry:
I had this problem a long time ago when I was developing for android natively. Try this solution in your tiapp.xml rather than android manifest: http://stackoverflow.com/questions/5983583/rotating-phone-restarts-video-on-android