question

mathiastck avatar image
mathiastck asked

Aspect ratio lost on Kindle Fire HD 7 inch for streaming content in VideoV

We have a VideoView in our application set to fill_parent, that we use for fullscreen playback of streaming content (we call mVideoView.setVideoURI). On the Kindle Fire HD 7 inch, and only on this device, when we start playback in portrait mode it looks fine at first, aspect ratio is preserved, and the movie appears in the middle 3rd of the device. However if allowed to play for a few mins, then suddenly the video loses its aspect ratio, and stretches vertically to fill the screen. Has anyone else experienced this issue, or have any insight into a possible cause or work around?
fire tablet
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dixith@Amazon avatar image
Dixith@Amazon answered
Hi, We have tested video on KindleFire HD 7 inch device and can able to play video without any issues. Please find the below snippet of code. final String html = " "; webView.loadData(html, "text/html", null); Flash player is available on Kindle Fire 1st generation device but not on KindleFire HD 7. So you can play the videos with HTML5 player with iframe tag. Hope this information helps you. If you have any issues with your code, please raise a contact-us( https://developer.amazon.com/help/contactus.html) with your snippet of code.Then one of our support engineer will assist you further.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mathiastck avatar image
mathiastck answered
Hello Dixith@Amazon, Thanks for the response, but you are describing using html to display YouTube video in an iframe I was reporting a problem related to using the native android VideoView: http://developer.android.com/reference/android/widget/VideoView.html in java code, from an Android Java application. The problem was that for streaming content, after a time, in portrait mode, it would initially preserve aspect ratio, but after a few mins it would fail to preserve aspect ratio, and the video would stretch its height to fill the container. The VideoView is setup like so in the layout: On most devices, (including the original Kinde Fire 7 inch), when we set the VideoView to play stringing content like so: mVideoView.setVideoURI(uri); it preserves aspect ratio, the video content stretches horizontal to fill it's container, but it will only stretch vertically as much as it can while preserving aspect ratio. The bug is that on the Kindle Fire HD 7 inch, after playing the streaming content for a view minutes, it fails to preserve the aspect ratio and the video content is stretched vertically to fill the container, causing the viceo content to appear to appear distorted. We have worked around this issue in our code by not relying on the VideoView to preserve it's aspect ratio, but to manually set it's height and width to an appropriate size on the display, and to values that do preserve the aspect ratio (9/16) in this case). RelativeLayout.LayoutParams videoLayoutParams = new RelativeLayout.LayoutParams(display.getWidth(), (9*display.getWidth())/16); videoLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT); mVideoView.setLayoutParams(videoLayoutParams); If anyone else is seeing this issue this solution may work for them as well. Thanks, -MK
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Samuel@Amazon avatar image
Samuel@Amazon answered
Hello mathiastck, thank you for following up on this thread and providing the solution as well. Surely this will help other developers who are looking for the relative information on VideoView. Thanks again.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.