Skip to content

Commit

Permalink
Get Maui to play
Browse files Browse the repository at this point in the history
  • Loading branch information
martijn00 committed Jan 12, 2023
1 parent 35b27f7 commit e11514c
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<AssemblyName>MediaManager.AzureMediaServices</AssemblyName>
<RootNamespace>MediaManager.AzureMediaServices</RootNamespace>
<PackageId>Plugin.MediaManager.AzureMediaServices</PackageId>
<Description>Cross platform Xamarin plugin to play and control Audio and Video</Description>
<Description>Cross platform .NET plugin to play and control Audio and Video</Description>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<AssemblyName>MediaManager.FFmpegMediaMetadataRetriever</AssemblyName>
<RootNamespace>MediaManager.FFmpegMediaMetadataRetriever</RootNamespace>
<PackageId>Plugin.MediaManager.FFmpegMediaMetadataRetriever</PackageId>
<Description>Cross platform Xamarin plugin to play and control Audio and Video</Description>
<Description>Cross platform .NET plugin to play and control Audio and Video</Description>
</PropertyGroup>

<ItemGroup>
Expand Down
32 changes: 13 additions & 19 deletions MediaManager.Forms/MediaManager.Forms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<AssemblyName>MediaManager.Forms</AssemblyName>
<RootNamespace>MediaManager.Forms</RootNamespace>
<PackageId>Plugin.MediaManager.Forms</PackageId>
<Description>Cross platform Xamarin plugin to play and control Audio and Video. This adds Xamarin.Forms specific features</Description>
<Description>Cross platform .NET plugin to play and control Audio and Video. This adds .NET MAUI / Xamarin.Forms specific features</Description>
</PropertyGroup>

<ItemGroup>
Expand All @@ -27,55 +27,49 @@
<None Include="readme.txt" pack="true" PackagePath="." />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) And '$(OS)' == 'Windows_NT'">
<Compile Include="Platforms\Net\**\*.cs" />
<Compile Include="Platforms\Wpf\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('netcoreapp3')) And '$(OS)' == 'Windows_NT'">
<Compile Include="Platforms\Net\**\*.cs" />
<Compile Include="Platforms\Wpf\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-windows')) And '$(OS)' == 'Windows_NT'">
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows' And $([MSBuild]::IsOSPlatform('windows'))">
<Compile Include="Platforms\Uap\**\*.cs" />
<Page Include="Platforms\Uap\**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
<None Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
<Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-ios')) ">
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
<None Remove="Platforms\Apple\**\*.cs" />
<None Remove="Platforms\Ios\**\*.cs" />
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Ios\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-mac')) ">
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
<None Remove="Platforms\Apple\**\*.cs" />
<None Remove="Platforms\Mac\**\*.cs" />
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Mac\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-tvos')) ">
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tvos'" >
<None Remove="Platforms\Apple\**\*.cs" />
<None Remove="Platforms\Ios\**\*.cs" />
<None Remove="Platforms\Tvos\**\*.cs" />
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Ios\**\*.cs" />
<Compile Include="Platforms\Tvos\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-watchos')) ">
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'watchos'">
<None Remove="Platforms\Apple\**\*.cs" />
<None Remove="Platforms\Watchos\**\*.cs" />
<Compile Include="Platforms\Apple\**\*.cs" />
<Compile Include="Platforms\Watchos\**\*.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-android')) ">
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<None Remove="Platforms\Android\**\*.cs" />
<Compile Include="Platforms\Android\**\*.cs" />
<AndroidResource Include="Resources\**\*.xml" SubType="Designer" Generator="MSBuild:UpdateAndroidResources" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net6.0-tizen')) ">
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">
<None Remove="Platforms\Tizen\**\*.cs" />
<Compile Include="Platforms\Tizen\**\*.cs" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion MediaManager/MediaManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<AssemblyName>MediaManager</AssemblyName>
<RootNamespace>MediaManager</RootNamespace>
<PackageId>Plugin.MediaManager</PackageId>
<Description>Cross platform Xamarin plugin to play and control Audio and Video</Description>
<Description>Cross platform .NET Xamarin plugin to play and control Audio and Video</Description>
</PropertyGroup>

<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows' And $([MSBuild]::IsOSPlatform('windows'))">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected virtual void Initialize()
else
UserAgent = Util.GetUserAgent(Context, Context.PackageName);

HttpDataSourceFactory = new DefaultHttpDataSource.Factory().SetUserAgent(UserAgent);
HttpDataSourceFactory = new DefaultHttpDataSource.Factory().SetUserAgent(UserAgent).SetAllowCrossProtocolRedirects(true);
UpdateRequestHeaders();

MediaSource = new ConcatenatingMediaSource();
Expand Down
2 changes: 1 addition & 1 deletion MediaManager/Platforms/Android/Video/VideoView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace MediaManager.Platforms.Android.Video
{
[Register("mediamanager.platforms.android.video.VideoView")]
public class VideoView : PlayerView, IVideoView
public class VideoView : StyledPlayerView, IVideoView
{
protected MediaManagerImplementation MediaManager => CrossMediaManager.Android;

Expand Down
2 changes: 1 addition & 1 deletion Samples/AndroidPlayerSample/AndroidPlayerSample.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-android</TargetFramework>
<TargetFrameworks>net7.0-android</TargetFrameworks>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
Expand Down
13 changes: 8 additions & 5 deletions Samples/MauiPlayerSample/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mm="clr-namespace:MediaManager.Forms;assembly=MediaManager.Forms"
xmlns:mm="clr-namespace:MediaManager.Forms;assembly=MediaManager.Forms"
x:Class="MauiPlayerSample.MainPage">


<mm:VideoView BackgroundColor="Red" HorizontalOptions="FillAndExpand" HeightRequest="300" VideoAspect="AspectFit" ShowControls="True" AutoPlay="True" Source="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" />


<ContentPage.Content>
<StackLayout Orientation="Vertical">
<Button Text="Play" Clicked="Button_Clicked" />
<mm:VideoView BackgroundColor="Transparent" VerticalOptions="FillAndExpand" VideoAspect="AspectFit" ShowControls="True" IsFullWindow="True" Source="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" />
</StackLayout>
</ContentPage.Content>

</ContentPage>
6 changes: 2 additions & 4 deletions Samples/MauiPlayerSample/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ public MainPage()
InitializeComponent();
}

protected override void OnAppearing()
private async void Button_Clicked(object sender, EventArgs e)
{
base.OnAppearing();

//CrossMediaManager.Current.Play("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4");
await CrossMediaManager.Current.Play("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4");
}
}
}

0 comments on commit e11514c

Please sign in to comment.