Playing the live feed using WebView in Xamarin

Vuyiswa Maseko 351 Reputation points

Good Day All

I have a live stream site created with that works well. i want to show this in a Xamarin application using WebView. The following is the defination of the WebView

>      <StackLayout>  
>             <WebView x:Name="webLive" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"></WebView>  
>         </StackLayout>  

and i am assigning the value like this

  ChannelToken = "AA7ED24C-9DFF-4C60-8B06-96EAFB749BB1";  

    webLive.Source = "" + ChannelToken;  

The URL works but my App does not want to play the video or live feed as depicted in the image below


A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,300 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 69,311 Reputation points Microsoft Vendor


    If you want to show webrtc, you need to add following permission in your AndroidManifest.xml.

       <uses-permission android:name="android.permission.CAMERA"/>  
       <uses-feature android:name="" android:required="true"/>  
       <uses-feature android:name=""/>  
       <uses-permission android:name="android.permission.RECORD_AUDIO" />  
       <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />  

    Then you need to create a custom renderer for your WebView to enable the JavaScript and request permission.

       [assembly: ExportRenderer(typeof(WebView), typeof(MyWebview))]  
       namespace webviewPlayVideo.Droid  
           internal class MyWebview : WebViewRenderer  
               public MyWebview(Context context) : base(context)  
               protected override void OnElementChanged(ElementChangedEventArgs<WebView> e)  
                   if (Control!=null) {  
                       Control.Settings.JavaScriptEnabled = true;  
                       Control.SetWebChromeClient(new MyWebChromeClient());  
          internal class MyWebChromeClient : Android.Webkit.WebChromeClient  
               public override void OnPermissionRequest(Android.Webkit.PermissionRequest request)  

    Please note: Test link is not working.

    Best Regards,

    Leon Lu

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Vuyiswa Maseko 351 Reputation points

    Thank you it worked 100%

    0 comments No comments