using System;
using MediaManager;
using Xamarin.CommunityToolkit.Core;
using Xamarin.Essentials;
using Xamarin.Forms;

namespace iElection.Views
{
    public partial class TestPage : ContentPage
    {
        public TestPage()
        {
            InitializeComponent();
            string htmlText = @"<video controls><source src=""http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"" type=""video/mp4""></video>";
            var browser = new WebView();
            browser.HeightRequest = 500;
            browser.WidthRequest = 200;
            var html = new HtmlWebViewSource
            {
                Html = htmlText
            };
            browser.Source = html;
            browserFrame.Content = browser;
        }

        private void Button_OnClicked(object sender, EventArgs e)
        {
            Permissions.RequestAsync<Permissions.StorageRead>();
            Permissions.RequestAsync<Permissions.StorageWrite>();
            Permissions.RequestAsync<Permissions.Media>();
        }

        private void MediaElement_OnSeekCompleted(object sender, EventArgs e)
        {
            
        }

        private void MediaElement_OnMediaFailed(object sender, EventArgs e)
        {
            
        }
    }
}
