NOTE: I had to redact some links because of this forum. So some of the code below is incomplete...
I'm trying to get videos to autoplay through WebView; if someone has a better suggestion, I'm all ears. (youtube and/or vimeo)
The WebView policies seem to be preventing the videos from autoplaying, so I wanted to set
setMediaPlaybackRequiresUserGesture(false) on the component. That applies for Android, so in pseudo-code, it's something along the lines of:
// pseudo code WebView wv = new WebView(); wv.getSettings().setMediaPlaybackRequiresUserGesture(false);
I'm not sure how to combine something like this with the fact I have my
<WebView Source="..." /> component existing in the shared Forms. I've tried using
mute=0 without a difference.
<?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns="[redacted]" xmlns:x="[redacted]" x:Class="BlankFormsApp01.SecondPage"> <ContentPage.Content> <WebView Source="[redacted]/AZS5cgybKcI?autoplay=1&mute=1&controls=0&disablekb=1&enablejsapi=1&fs=0&iv_load_policy=3&loop=0&playsinline=1&rel=0&" HorizontalOptions="CenterAndExpand" WidthRequest="380" HeightRequest="700" /> </ContentPage.Content> </ContentPage>
What sort of approach am I looking for here? How do I apply that Android specific code to my
WebView in Forms? Do I need to create a controller in Android that gets called from one of my Shared code behind files? That being said, what's the approach for inline autoplayback on iOS?
I'd be open to a native component of some kind as opposed to embedding a WebView, but I wasn't able to find anything for that.
Anyway, I'm open to all sorts of suggestions.. but trying to understand how to combine Android specific settings that are laid out in Forms.