Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Webview as AndroidViewFilterRender not filling entire screen when activity in "Landscape Mode". #1674

Open
penmatsa opened this issue Dec 5, 2024 · 2 comments

Comments

@penmatsa
Copy link

penmatsa commented Dec 5, 2024

Hi @pedroSG94, we tried with webview as overlay filter but its not showing full screen in landscape mode.

Here is my code

//Main Activity Layout

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextureView
        android:id="@+id/textureView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"></TextureView>

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <WebView
        android:id="@+id/overlay_webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="invisible">

    </WebView>
</LinearLayout>

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:orientation="vertical">


    <ImageView
        android:id="@+id/b_start_stop"
        android:layout_width="98dp"
        android:layout_height="98dp"
        android:src="@drawable/stream_icon" />

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/bitrate_tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="18dp"
        android:textColor="@color/teal_200"
        android:textSize="36sp" />

</LinearLayout>

// Inflate Views from xml

stream_start_stop = findViewById(R.id.b_start_stop)
bitrate_tv = findViewById(R.id.bitrate_tv)
overlay_webview = findViewById(R.id.overlay_webview);

//web view intialization

overlay_webview.setBackgroundColor(Color.TRANSPARENT);
overlay_webview.getSettings().setJavaScriptEnabled(true);
overlay_webview.getSettings().setLoadWithOverviewMode(true);
overlay_webview.getSettings().setUseWideViewPort(true);
overlay_webview.webViewClient = object : WebViewClient() {

        override fun shouldOverrideUrlLoading(
            view: WebView?,
            request: WebResourceRequest?
        ): Boolean {
            view?.loadUrl(request?.url.toString());
            return true
        }

        override fun onPageFinished(view: WebView?, url: String?) {

        }

    }

overlay_webview.loadUrl("https://www.youtube.com/")

//adding webview as filter

textureView = findViewById(R.id.textureView);
if (!genericStream.isOnPreview) genericStream.startPreview(textureView, true)
val androidViewFilterRender = AndroidViewFilterRender()
androidViewFilterRender.view = overlay_webview
androidViewFilterRender.setPosition(0f, 0f)
genericStream.getGlInterface().addFilter(androidViewFilterRender)

Output Image
0680dd80-b373-4be6-9de8-dd893a8e9d1c

AndroidViewFilterRender not matches entire sceen.

@pedroSG94
Copy link
Owner

pedroSG94 commented Dec 5, 2024

Hello,

I can't see set the scale to 100x100 (androidViewFilterRender.setScale(100f, 100f)).

@penmatsa
Copy link
Author

penmatsa commented Dec 5, 2024

Thanks @pedroSG94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants