我對Xamarin很新穎...Xamarin Forms視頻播放器(MediaManager插件)
我試圖創建一個類似於應用的YouTube。我不知道如何在我的應用程序內播放視頻。我試圖使用MediaManager插件https://github.com/martijn00/XamarinMediaManager,但根本無法弄清楚。
如果任何人都可以建議一個不同的插件,或者詳細解釋如何使用MediaManager插件,那就太棒了。
該插件的文檔是殘暴的,我根本無法理解它。
繼承人我到目前爲止:我只是試圖通過按鈕點擊播放視頻。
XAML文件:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App2.Video_Play_Page"
Title="Video_Play_Page"
BackgroundColor="#4B1388">
<ContentPage.Content>
<StackLayout Padding="10, 10, 10, 10">
<Label Text="video Player..." />
<Button Clicked="PlayVideo" Text="Play me!"/>
</StackLayout>
</ContentPage.Content>
Xaml.cs文件:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using Plugin.MediaManager;
namespace App2
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class Video_Play_Page : ContentPage
{
public Video_Play_Page()
{
InitializeComponent();
}
private void PlayVideo(object sender, EventArgs e)
{
CrossMediaManager.Current.Play("https://www.youtube.com/watch?v=Gm8bQxnold0");
}
}
}
注:我不知道我是否已經正確安裝了一切。如果有人能解釋一下,那也會很棒。
會[此答案](https://stackoverflow.com/a/44522846/7196681)有幫助嗎? – Curiousity