Skip to content

Commit 44d9173

Browse files
authored
Fix MediaElement windows fails to playback (#2915)
Fix MediaElement windows fails to playback after repeating an mp4 a distinct number of times
1 parent cab2374 commit 44d9173

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/CommunityToolkit.Maui.MediaElement/Views/MediaManager.windows.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ protected virtual async partial ValueTask PlatformUpdateSource()
291291
var uri = uriMediaSource.Uri?.AbsoluteUri;
292292
if (!string.IsNullOrWhiteSpace(uri))
293293
{
294-
Player.Source = WinMediaSource.CreateFromUri(new Uri(uri));
294+
Player.MediaPlayer.SetUriSource(new Uri(uri));
295295
}
296296
}
297297
else if (MediaElement.Source is FileMediaSource fileMediaSource)
@@ -300,7 +300,7 @@ protected virtual async partial ValueTask PlatformUpdateSource()
300300
if (!string.IsNullOrWhiteSpace(filename))
301301
{
302302
StorageFile storageFile = await StorageFile.GetFileFromPathAsync(filename);
303-
Player.Source = WinMediaSource.CreateFromStorageFile(storageFile);
303+
Player.MediaPlayer.SetFileSource(storageFile);
304304
}
305305
}
306306
else if (MediaElement.Source is ResourceMediaSource resourceMediaSource)
@@ -314,7 +314,7 @@ protected virtual async partial ValueTask PlatformUpdateSource()
314314
string path = GetFullAppPackageFilePath(resourceMediaSource.Path);
315315
if (!string.IsNullOrWhiteSpace(path))
316316
{
317-
Player.Source = WinMediaSource.CreateFromUri(new Uri(path));
317+
Player.MediaPlayer.SetUriSource(new Uri(path));
318318
}
319319
}
320320
}

0 commit comments

Comments
 (0)