WebChromeClient - FullScreen View Is black with sound












0














I have been trying to fix this issue for a while but I could not figure out what is wrong.



I have a 'WebView' as following



webView = FindViewById<WebView>(Resource.Id.thebrowserWebViewRss);
LinearLayout MainView = FindViewById<LinearLayout>(Resource.Id.rootviewRFeedbrwoser);
NestedScrollView ContentLayout = FindViewById<NestedScrollView>(Resource.Id.thebrowserScrollerViewRss);
FullScreenClient fullScreenClient = new FullScreenClient(MainView, ContentLayout)
{
ParentActivity = this
};
webView.SetWebChromeClient(fullScreenClient);
webView.Settings.JavaScriptEnabled = true;
webView.Settings.LoadWithOverviewMode = true;


Where my FullScreenClient is the following



     public class FullScreenClient : WebChromeClient
{
readonly FrameLayout.LayoutParams matchParentLayout = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,
ViewGroup.LayoutParams.MatchParent);
readonly ViewGroup content;
readonly ViewGroup parent;
View customView;
int counter = 0;


public WebBroswerRSS ParentActivity;

public FullScreenClient(ViewGroup parentview, ViewGroup contentview)
{
this.parent = parentview;
this.content = contentview;
}

public override void OnShowCustomView(View view, ICustomViewCallback callback)
{
customView = view;
view.LayoutParameters = matchParentLayout;
parent.AddView(view);
}

public override void OnHideCustomView()
{
content.Visibility = ViewStates.Visible;
parent.RemoveView(customView);
customView = null;
}

}


It works fine although when I click full screen on any video, It goes full screen but its all black. I can hear the video sound still in the background but can't see the video.



Any idea what I am doing wrong?



Here is the XML for my web browser



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:id="@+id/rootviewRFeedbrwoser"
android:background="#ffffff">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">

<ImageView
android:id="@+id/closer"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:padding="5dp"
android:src="@drawable/ic_left_arrow_black" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<ImageView
android:id="@+id/sharingIt"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@drawable/ic_share"
android:layout_gravity="right"
android:tint="#6E6E6E"
android:layout_marginRight="10dp"
android:padding="8dp"
/>
</LinearLayout>
</RelativeLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/thebrowserScrollerViewRss"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<WebView
android:id="@+id/thebrowserWebViewRss"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp" />
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>









share|improve this question
























  • I made a basic demo with your posted codes, but failed to reproduce the problem. Could you please post more detailed codes? or maybe share a basic demo that can reproduce the problem through online repo
    – York Shen - MSFT
    Nov 26 '18 at 7:10










  • Hey, cheers, The way I fixed this was to change the first LinearLayout to ` android.support.design.widget.CoordinatorLayout - I am still unsure why CoordinatorLayout works but not the LinearLayout - I needed a quick fix, therefore, I am using CoordinatorLayout - unfortunately the code is not available online but yes you are right, I used the same code in a blank app and it simply works. I am missing something.. really...
    – aliusman
    Nov 26 '18 at 7:19












  • Happy coding. :)
    – York Shen - MSFT
    Nov 26 '18 at 7:29
















0














I have been trying to fix this issue for a while but I could not figure out what is wrong.



I have a 'WebView' as following



webView = FindViewById<WebView>(Resource.Id.thebrowserWebViewRss);
LinearLayout MainView = FindViewById<LinearLayout>(Resource.Id.rootviewRFeedbrwoser);
NestedScrollView ContentLayout = FindViewById<NestedScrollView>(Resource.Id.thebrowserScrollerViewRss);
FullScreenClient fullScreenClient = new FullScreenClient(MainView, ContentLayout)
{
ParentActivity = this
};
webView.SetWebChromeClient(fullScreenClient);
webView.Settings.JavaScriptEnabled = true;
webView.Settings.LoadWithOverviewMode = true;


Where my FullScreenClient is the following



     public class FullScreenClient : WebChromeClient
{
readonly FrameLayout.LayoutParams matchParentLayout = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,
ViewGroup.LayoutParams.MatchParent);
readonly ViewGroup content;
readonly ViewGroup parent;
View customView;
int counter = 0;


public WebBroswerRSS ParentActivity;

public FullScreenClient(ViewGroup parentview, ViewGroup contentview)
{
this.parent = parentview;
this.content = contentview;
}

public override void OnShowCustomView(View view, ICustomViewCallback callback)
{
customView = view;
view.LayoutParameters = matchParentLayout;
parent.AddView(view);
}

public override void OnHideCustomView()
{
content.Visibility = ViewStates.Visible;
parent.RemoveView(customView);
customView = null;
}

}


It works fine although when I click full screen on any video, It goes full screen but its all black. I can hear the video sound still in the background but can't see the video.



Any idea what I am doing wrong?



Here is the XML for my web browser



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:id="@+id/rootviewRFeedbrwoser"
android:background="#ffffff">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">

<ImageView
android:id="@+id/closer"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:padding="5dp"
android:src="@drawable/ic_left_arrow_black" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<ImageView
android:id="@+id/sharingIt"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@drawable/ic_share"
android:layout_gravity="right"
android:tint="#6E6E6E"
android:layout_marginRight="10dp"
android:padding="8dp"
/>
</LinearLayout>
</RelativeLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/thebrowserScrollerViewRss"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<WebView
android:id="@+id/thebrowserWebViewRss"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp" />
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>









share|improve this question
























  • I made a basic demo with your posted codes, but failed to reproduce the problem. Could you please post more detailed codes? or maybe share a basic demo that can reproduce the problem through online repo
    – York Shen - MSFT
    Nov 26 '18 at 7:10










  • Hey, cheers, The way I fixed this was to change the first LinearLayout to ` android.support.design.widget.CoordinatorLayout - I am still unsure why CoordinatorLayout works but not the LinearLayout - I needed a quick fix, therefore, I am using CoordinatorLayout - unfortunately the code is not available online but yes you are right, I used the same code in a blank app and it simply works. I am missing something.. really...
    – aliusman
    Nov 26 '18 at 7:19












  • Happy coding. :)
    – York Shen - MSFT
    Nov 26 '18 at 7:29














0












0








0







I have been trying to fix this issue for a while but I could not figure out what is wrong.



I have a 'WebView' as following



webView = FindViewById<WebView>(Resource.Id.thebrowserWebViewRss);
LinearLayout MainView = FindViewById<LinearLayout>(Resource.Id.rootviewRFeedbrwoser);
NestedScrollView ContentLayout = FindViewById<NestedScrollView>(Resource.Id.thebrowserScrollerViewRss);
FullScreenClient fullScreenClient = new FullScreenClient(MainView, ContentLayout)
{
ParentActivity = this
};
webView.SetWebChromeClient(fullScreenClient);
webView.Settings.JavaScriptEnabled = true;
webView.Settings.LoadWithOverviewMode = true;


Where my FullScreenClient is the following



     public class FullScreenClient : WebChromeClient
{
readonly FrameLayout.LayoutParams matchParentLayout = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,
ViewGroup.LayoutParams.MatchParent);
readonly ViewGroup content;
readonly ViewGroup parent;
View customView;
int counter = 0;


public WebBroswerRSS ParentActivity;

public FullScreenClient(ViewGroup parentview, ViewGroup contentview)
{
this.parent = parentview;
this.content = contentview;
}

public override void OnShowCustomView(View view, ICustomViewCallback callback)
{
customView = view;
view.LayoutParameters = matchParentLayout;
parent.AddView(view);
}

public override void OnHideCustomView()
{
content.Visibility = ViewStates.Visible;
parent.RemoveView(customView);
customView = null;
}

}


It works fine although when I click full screen on any video, It goes full screen but its all black. I can hear the video sound still in the background but can't see the video.



Any idea what I am doing wrong?



Here is the XML for my web browser



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:id="@+id/rootviewRFeedbrwoser"
android:background="#ffffff">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">

<ImageView
android:id="@+id/closer"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:padding="5dp"
android:src="@drawable/ic_left_arrow_black" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<ImageView
android:id="@+id/sharingIt"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@drawable/ic_share"
android:layout_gravity="right"
android:tint="#6E6E6E"
android:layout_marginRight="10dp"
android:padding="8dp"
/>
</LinearLayout>
</RelativeLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/thebrowserScrollerViewRss"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<WebView
android:id="@+id/thebrowserWebViewRss"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp" />
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>









share|improve this question















I have been trying to fix this issue for a while but I could not figure out what is wrong.



I have a 'WebView' as following



webView = FindViewById<WebView>(Resource.Id.thebrowserWebViewRss);
LinearLayout MainView = FindViewById<LinearLayout>(Resource.Id.rootviewRFeedbrwoser);
NestedScrollView ContentLayout = FindViewById<NestedScrollView>(Resource.Id.thebrowserScrollerViewRss);
FullScreenClient fullScreenClient = new FullScreenClient(MainView, ContentLayout)
{
ParentActivity = this
};
webView.SetWebChromeClient(fullScreenClient);
webView.Settings.JavaScriptEnabled = true;
webView.Settings.LoadWithOverviewMode = true;


Where my FullScreenClient is the following



     public class FullScreenClient : WebChromeClient
{
readonly FrameLayout.LayoutParams matchParentLayout = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,
ViewGroup.LayoutParams.MatchParent);
readonly ViewGroup content;
readonly ViewGroup parent;
View customView;
int counter = 0;


public WebBroswerRSS ParentActivity;

public FullScreenClient(ViewGroup parentview, ViewGroup contentview)
{
this.parent = parentview;
this.content = contentview;
}

public override void OnShowCustomView(View view, ICustomViewCallback callback)
{
customView = view;
view.LayoutParameters = matchParentLayout;
parent.AddView(view);
}

public override void OnHideCustomView()
{
content.Visibility = ViewStates.Visible;
parent.RemoveView(customView);
customView = null;
}

}


It works fine although when I click full screen on any video, It goes full screen but its all black. I can hear the video sound still in the background but can't see the video.



Any idea what I am doing wrong?



Here is the XML for my web browser



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:id="@+id/rootviewRFeedbrwoser"
android:background="#ffffff">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">

<ImageView
android:id="@+id/closer"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:padding="5dp"
android:src="@drawable/ic_left_arrow_black" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<ImageView
android:id="@+id/sharingIt"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@drawable/ic_share"
android:layout_gravity="right"
android:tint="#6E6E6E"
android:layout_marginRight="10dp"
android:padding="8dp"
/>
</LinearLayout>
</RelativeLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/thebrowserScrollerViewRss"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<WebView
android:id="@+id/thebrowserWebViewRss"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp" />
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>






c# android xamarin






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 5:45









Jaymin

1,5721825




1,5721825










asked Nov 23 '18 at 5:40









aliusman

9741219




9741219












  • I made a basic demo with your posted codes, but failed to reproduce the problem. Could you please post more detailed codes? or maybe share a basic demo that can reproduce the problem through online repo
    – York Shen - MSFT
    Nov 26 '18 at 7:10










  • Hey, cheers, The way I fixed this was to change the first LinearLayout to ` android.support.design.widget.CoordinatorLayout - I am still unsure why CoordinatorLayout works but not the LinearLayout - I needed a quick fix, therefore, I am using CoordinatorLayout - unfortunately the code is not available online but yes you are right, I used the same code in a blank app and it simply works. I am missing something.. really...
    – aliusman
    Nov 26 '18 at 7:19












  • Happy coding. :)
    – York Shen - MSFT
    Nov 26 '18 at 7:29


















  • I made a basic demo with your posted codes, but failed to reproduce the problem. Could you please post more detailed codes? or maybe share a basic demo that can reproduce the problem through online repo
    – York Shen - MSFT
    Nov 26 '18 at 7:10










  • Hey, cheers, The way I fixed this was to change the first LinearLayout to ` android.support.design.widget.CoordinatorLayout - I am still unsure why CoordinatorLayout works but not the LinearLayout - I needed a quick fix, therefore, I am using CoordinatorLayout - unfortunately the code is not available online but yes you are right, I used the same code in a blank app and it simply works. I am missing something.. really...
    – aliusman
    Nov 26 '18 at 7:19












  • Happy coding. :)
    – York Shen - MSFT
    Nov 26 '18 at 7:29
















I made a basic demo with your posted codes, but failed to reproduce the problem. Could you please post more detailed codes? or maybe share a basic demo that can reproduce the problem through online repo
– York Shen - MSFT
Nov 26 '18 at 7:10




I made a basic demo with your posted codes, but failed to reproduce the problem. Could you please post more detailed codes? or maybe share a basic demo that can reproduce the problem through online repo
– York Shen - MSFT
Nov 26 '18 at 7:10












Hey, cheers, The way I fixed this was to change the first LinearLayout to ` android.support.design.widget.CoordinatorLayout - I am still unsure why CoordinatorLayout works but not the LinearLayout - I needed a quick fix, therefore, I am using CoordinatorLayout - unfortunately the code is not available online but yes you are right, I used the same code in a blank app and it simply works. I am missing something.. really...
– aliusman
Nov 26 '18 at 7:19






Hey, cheers, The way I fixed this was to change the first LinearLayout to ` android.support.design.widget.CoordinatorLayout - I am still unsure why CoordinatorLayout works but not the LinearLayout - I needed a quick fix, therefore, I am using CoordinatorLayout - unfortunately the code is not available online but yes you are right, I used the same code in a blank app and it simply works. I am missing something.. really...
– aliusman
Nov 26 '18 at 7:19














Happy coding. :)
– York Shen - MSFT
Nov 26 '18 at 7:29




Happy coding. :)
– York Shen - MSFT
Nov 26 '18 at 7:29












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53441170%2fwebchromeclient-fullscreen-view-is-black-with-sound%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53441170%2fwebchromeclient-fullscreen-view-is-black-with-sound%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Basket-ball féminin

Different font size/position of beamer's navigation symbols template's content depending on regular/plain...

I want to find a topological embedding $f : X rightarrow Y$ and $g: Y rightarrow X$, yet $X$ is not...