Skip to content

Commit 7b8c395

Browse files
dotnet format
1 parent aa591d8 commit 7b8c395

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

samples/CommunityToolkit.Maui.Sample/Pages/Views/MediaElement/MediaElementPage.xaml.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public partial class MediaElementPage : BasePage<MediaElementViewModel>
1919
const string botImageUrl = "https://lh3.googleusercontent.com/pw/AP1GczNRrebWCJvfdIau1EbsyyYiwAfwHS0JXjbioXvHqEwYIIdCzuLodQCZmA57GADIo5iB3yMMx3t_vsefbfoHwSg0jfUjIXaI83xpiih6d-oT7qD_slR0VgNtfAwJhDBU09kS5V2T5ZML-WWZn8IrjD4J-g=w1792-h1024-s-no-gm";
2020
const string hlsStreamTestUrl = "https://mtoczko.github.io/hls-test-streams/test-gap/playlist.m3u8";
2121
const string hal9000AudioUrl = "https://github.com/prof3ssorSt3v3/media-sample-files/raw/master/hal-9000.mp3";
22-
23-
22+
23+
2424
readonly ILogger logger;
2525
readonly IDeviceInfo deviceInfo;
2626
readonly IFileSystem fileSystem;
@@ -256,14 +256,14 @@ async void DisplayPopup(object sender, EventArgs e)
256256
MediaElement.Pause();
257257

258258
MediaSource source;
259-
259+
260260
if (deviceInfo.Platform == DevicePlatform.Android)
261261
{
262262
source = MediaSource.FromResource("AndroidVideo.mp4");
263263
}
264264
else if (deviceInfo.Platform == DevicePlatform.MacCatalyst
265-
|| deviceInfo.Platform == DevicePlatform.iOS
266-
|| deviceInfo.Platform == DevicePlatform.macOS)
265+
|| deviceInfo.Platform == DevicePlatform.iOS
266+
|| deviceInfo.Platform == DevicePlatform.macOS)
267267
{
268268
source = MediaSource.FromResource("AppleVideo.mp4");
269269
}
@@ -273,7 +273,7 @@ async void DisplayPopup(object sender, EventArgs e)
273273
}
274274

275275
var artworkFilePath = await GetFilePath("dotnet_bot.png");
276-
276+
277277
var popupMediaElement = new MediaElement
278278
{
279279
AndroidViewType = AndroidViewType.SurfaceView,
@@ -282,9 +282,9 @@ async void DisplayPopup(object sender, EventArgs e)
282282
ShouldAutoPlay = true,
283283
ShouldShowPlaybackControls = true,
284284
};
285-
285+
286286
await this.ShowPopupAsync(popupMediaElement);
287-
287+
288288
popupMediaElement.Stop();
289289
popupMediaElement.Source = null;
290290
}
@@ -298,7 +298,7 @@ async Task<string> GetFilePath(string fileName)
298298

299299
// Extract to cache directory to get a real file path
300300
string targetPath = Path.Combine(FileSystem.CacheDirectory, fileName);
301-
301+
302302
// Check if already extracted
303303
if (File.Exists(targetPath))
304304
{
@@ -309,7 +309,7 @@ async Task<string> GetFilePath(string fileName)
309309
await using var sourceStream = await FileSystem.OpenAppPackageFileAsync(fileName);
310310
await using var targetStream = File.Create(targetPath);
311311
await sourceStream.CopyToAsync(targetStream);
312-
312+
313313
return targetPath;
314314
}
315315
}

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ static async Task<byte[]> GetBytesFromMetadataArtworkUrl(string url, Cancellatio
543543
{
544544
return [];
545545
}
546-
546+
547547
Stream? stream = null;
548548
Uri.TryCreate(url, UriKind.Absolute, out var uri);
549549

@@ -554,7 +554,7 @@ static async Task<byte[]> GetBytesFromMetadataArtworkUrl(string url, Cancellatio
554554

555555
// HTTP or HTTPS URL
556556
if (uri is not null &&
557-
(uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps))
557+
(uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps))
558558
{
559559
var request = new HttpRequestMessage(HttpMethod.Head, url);
560560
var contentLengthResponse = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
@@ -567,15 +567,15 @@ static async Task<byte[]> GetBytesFromMetadataArtworkUrl(string url, Cancellatio
567567
else if (uri is not null && uri.Scheme == Uri.UriSchemeFile)
568568
{
569569
var normalizedFilePath = NormalizeFilePath(url);
570-
570+
571571
stream = File.Open(normalizedFilePath, FileMode.Create);
572572
contentLength = await GetByteCountFromStream(stream, cancellationToken);
573573
}
574574
// Relative File Path
575575
else if (Uri.TryCreate(url, UriKind.Relative, out _))
576576
{
577577
var normalizedFilePath = NormalizeFilePath(url);
578-
578+
579579
stream = Platform.AppContext.Assets?.Open(normalizedFilePath) ?? throw new InvalidOperationException("Assets cannot be null");
580580
contentLength = await GetByteCountFromStream(stream, cancellationToken);
581581
}
@@ -607,7 +607,7 @@ static async Task<byte[]> GetBytesFromMetadataArtworkUrl(string url, Cancellatio
607607
await stream.DisposeAsync();
608608
}
609609
}
610-
610+
611611
static string NormalizeFilePath(string filePath) => filePath.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar);
612612

613613
static async ValueTask<long> GetByteCountFromStream(Stream stream, CancellationToken token)
@@ -618,15 +618,15 @@ static async ValueTask<long> GetByteCountFromStream(Stream stream, CancellationT
618618
}
619619

620620
long countedStreamBytes = 0;
621-
621+
622622
var buffer = new byte[8192];
623623
int bytesRead;
624-
624+
625625
while ((bytesRead = await stream.ReadAsync(buffer, token)) > 0)
626626
{
627627
countedStreamBytes += bytesRead;
628628
}
629-
629+
630630
return countedStreamBytes;
631631
}
632632
}
@@ -707,7 +707,7 @@ void StopService(in BoundServiceConnection boundServiceConnection)
707707
mediaMetaData.SetArtist(MediaElement.MetadataArtist);
708708
mediaMetaData.SetTitle(MediaElement.MetadataTitle);
709709
var data = await GetBytesFromMetadataArtworkUrl(MediaElement.MetadataArtworkUrl, cancellationToken).ConfigureAwait(true);
710-
if (data != null && data.Length > 0)
710+
if (data is not null && data.Length > 0)
711711
{
712712
mediaMetaData.SetArtworkData(data, (Java.Lang.Integer)MediaMetadata.PictureTypeFrontCover);
713713
}

0 commit comments

Comments
 (0)