WebView视频在xaml中不能正确播放



当我在web视图中打开Binding url时,视频只播放音频,而不是模拟器和手机上的视觉效果。当我在我的pc和手机上打开Binding url时,它工作得很好。

有什么好办法吗?

<?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="WiscOnline.Mobile.ViewLearningItem"
Title="{Binding LearningItem.Name}">
<WebView x:Name="webView"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Source="{Binding CurrentSource}" />
<StackLayout>
   <Label Text="{Binding LearningItem.ViewUrl}" FontSize="19"></Label>
</StackLayout>
   <WebView Source="{Binding LearningItem.ViewUrl}" ></WebView>
</ContentPage>

这个问题是Android的WebView,而不是Xamarin。不同版本的Android将支持不同的WebView功能。WebView下的视频播放效果特别差。

一个更好的选择是为每个平台使用本机视频播放器,或者至少在Android上使用本机视频播放器。

你可以使用一个方便的插件/组件,比如这个(我从来没有尝试过,但看到它是别人推荐的),或者你可以尝试使用原生Android VideoView自己滚动一个。

关于这个问题和使用VideoView的Xamarin Forms线程可以在这里找到。

最新更新