-
The MediaElement XAML control was working well in Xamarin, please include it for MAUI ! |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 23 replies
-
We are currently working on porting the features from Xamarin Community Toolkit to the Maui Community Toolkit. MediaElement will be included before we publish the first release candidate of .NET MAUI Toolkit in November 2021. |
Beta Was this translation helpful? Give feedback.
-
Please don't port that MediaElement, it is designed weirdly and can only read files in specific locations. a real Media[Player] should be designed to read Streams not urls or files |
Beta Was this translation helpful? Give feedback.
-
@brminnick here is quick one. public enum MediaPlayerState
{
Loading,
Loaded,
Seeking,
Playing,
Paused,
Stopped
}
public enum PlayListType
{
Ordered,
Shuffled
}
public enum RepeatType
{
Once,
Repeat
}
public interface IMauiView
{ }
public interface IMediaAd
{
TimeSpan Time { get; }
TimeSpan Duration { get; }
}
public interface IMediaItem
{
Task<Stream> GetStream(CancellationToken ct = default);
}
public interface IVolumeController
{
float Balance { get; set; }
bool IsMute { get; set; }
}
public delegate void AdLoadedDelegate(object sender, int index, IMediaAd ad);
public delegate void AdPlayingDelegate(object sender, int index, IMediaAd ad);
public delegate void AdSkippedDelegate(object sender, int index, IMediaAd ad);
public delegate void AdClickedDelegate(object sender, int index, IMediaAd ad);
public delegate void AdFinishedDelegate(object sender, int index, IMediaAd ad);
public delegate void AdFailedDelegate(object sender, int index, IMediaAd ad);
public delegate void MediaStateChangedDelegate(object sender, MediaPlayerState state);
public interface IMediaPlayerController
{
event AdLoadedDelegate AdLoaded;
event AdPlayingDelegate AdPlaying;
event AdClickedDelegate AdClicked;
event AdSkippedDelegate AdSkipped;
event AdFinishedDelegate AdFinished;
event AdFailedDelegate AdFailed;
event MediaStateChangedDelegate StateChanged;
IReadOnlyCollection<IMediaItem> MediaList { get; }
IMediaItem CurrentItem { get; }
int CurrentIndex { get; }
bool IsPlayingList { get; }
IMediaAd CurrentAd { get; }
int CurrentAdIndex { get; }
IReadOnlyCollection<IMediaAd> AdList { get; }
bool CanSeek { get; }
TimeSpan Position { get; }
TimeSpan Duration { get; }
double Length { get; }
bool IsLive { get; }
bool IsVideo { get; }
double VideoWidth { get; }
double VideoHeight { get; }
double VideoAspectRatio { get; }
Stream Stram { get; }
IVolumeController Volume { get; }
MediaPlayerState State { get; }
bool AutoPlay { get; set; }
float Speed { get; set; }
void AddMediaItem(IMediaItem item);
void RemoveMediaItem(int index);
Task Play(IMediaItem item, CancellationToken ct = default);
Task PlayList(int index = 0, CancellationToken ct = default);
Task Stop(CancellationToken ct = default);
Task Pause(CancellationToken ct = default);
Task PlayNext(CancellationToken ct = default);
Task PlayPrevious(CancellationToken ct = default);
Task SeekForward(TimeSpan? duration = null, CancellationToken ct = default);
Task SeekBackward(TimeSpan? duration = null, CancellationToken ct = default);
}
public interface IInnerMediaView : IMauiView
{
}
public interface IVideoView : IMauiView
{
IMediaPlayerController Player { get; }
}
public interface IMediaControlsView : IMauiView
{
}
public interface IMediaPlayer
{
IInnerMediaView LoadingView { get; set; }
IInnerMediaView ErrorView { get; set; }
IInnerMediaView AudioView { get; set; }
IVideoView VideoView { get; set; }
IMediaControlsView ControlsView { get; set; }
IMediaPlayerController Player { get; set; }
} |
Beta Was this translation helpful? Give feedback.
-
@brminnick any updates for this migration? :) |
Beta Was this translation helpful? Give feedback.
-
Is this code supposed to work or not yet?
I installed the toolkit : Install-Package CommunityToolkit.Maui -Version 1.0.0 When I run the code, I get no error but no sound either. Please advise. |
Beta Was this translation helpful? Give feedback.
-
I already tried Xamarin.CommunityToolkit.MauiCompat, but what is the correct syntax for this line with Xamarin.CommunityToolkit.MauiCompat?
It is not working for me. Thanks |
Beta Was this translation helpful? Give feedback.
-
Is there a projected date to have MediaElement in the Maui toolkit? In the top of this discussion, it says: "MediaElement will be included before we publish the first release candidate of .NET MAUI Toolkit in November 2021." |
Beta Was this translation helpful? Give feedback.
-
Closed as completed. |
Beta Was this translation helpful? Give feedback.
We are currently working on porting the features from Xamarin Community Toolkit to the Maui Community Toolkit. MediaElement will be included before we publish the first release candidate of .NET MAUI Toolkit in November 2021.