Android video displayed wrong in specific portrait rotation -
i using geniatech atv1220 running android 4.2.2 display video in simple videoview
. connected monitor via hdmi port. setup need display content in different orientations. works fine in 3 of 4 orientations (landscape, landscape flipped, portrait flipped). in portrait video displayed wrong though.
i created basic application reproduce behaviour. (https://github.com/ingoalbers/simplevideoview)
the relevant parts:
videoviewactivity
public class videoviewactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_video_view); final videoview videoview = (videoview) findviewbyid(com.ingoalbers.simplevideoview.r.id.videoview); assert videoview != null; videoview.setvideopath("http://clips.vorwaerts-gmbh.de/vfe_html5.mp4"); videoview.start(); } }
androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.ingoalbers.simplevideoview"> <uses-permission android:name="android.permission.internet"/> <application android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme"> <activity android:name=".videoviewactivity" android:configchanges="orientation|keyboardhidden|screensize" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.main"/> <category android:name="android.intent.category.launcher"/> </intent-filter> </activity> </application> </manifest>
activity_video_view.xml
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.ingoalbers.simplevideoview.videoviewactivity"> <videoview android:id="@+id/videoview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerinparent="true"/> </relativelayout>
portrait flipped
landscape
portrait
as can see in portrait mode video played using 50% of screen width , seems stretched in height cannot see whole video.
i had same behaviour in textureview
, surfaceview
. think problem related mediaplayer
. changed android:background
property of videoview
red , saw actual dimensions of videoview
correct.
this system or hardware related problem, might able solve in programmatic way, other applications, default videoplayer application don't suffer behaviour.
it should possible me change system settings, etc. happy provide additional information , files might needed solve issue.
update:
i able reproduce problem using mxplayer. but when switched hw sw decoding rendered correctly. there no vertical stretching of video hw decoding, still showed 50% of width.
update #2:
when turn on "show surface updates" in developer options half of screen video displayed flashing in portrait mode. in 3 other orientations whole screen flashing.
portrait flipped
portrait
additionally uploaded system videoplayer.apk, can play video correctly, if might anyone.
Comments
Post a Comment