HMS-Core / hms-ml-demo

HMS ML Demo provides an example of integrating Huawei ML Kit service into applications. This example demonstrates how to integrate services provided by ML Kit, such as face detection, text recognition, image segmentation, asr, and tts.
https://developer.huawei.com/consumer/en/hms/huawei-mlkit?ha_source=hms1
Apache License 2.0
362 stars 120 forks source link

Why the VideoView inside LensEnginePreview is always Stretched #77

Open Ali-cryptoo opened 3 years ago

Ali-cryptoo commented 3 years ago

Hi, I've noticed that the VideoView is always stretched, I tried to resize it with a custom height, but it doesn't work.

e.g. :

    <com.huawei.mlkit.sample.camera.LensEnginePreview
        android:id="@+id/preview"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageView
            android:id="@+id/background"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="fitXY" />

        <VideoView
            android:id="@+id/video"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <com.huawei.mlkit.sample.views.overlay.GraphicOverlay
            android:id="@+id/graphic"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </com.huawei.mlkit.sample.camera.LensEnginePreview>
SoftwareGift commented 3 years ago

You may need to rotate it 90 degrees and resize it.Better landscape effect.