Skip to content

Commit

Permalink
Add try catch back in
Browse files Browse the repository at this point in the history
  • Loading branch information
martijn00 committed Jul 26, 2019
1 parent cd19f9f commit 09b7f35
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions MediaManager/Platforms/Android/Media/MediaExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,28 @@ public MediaExtractor()

public override async Task<IMediaItem> ExtractMetadata(IMediaItem mediaItem)
{
var metaRetriever = new MediaMetadataRetriever();
try
{
var metaRetriever = new MediaMetadataRetriever();

switch (mediaItem.MediaLocation)
{
case MediaLocation.Embedded:
case MediaLocation.FileSystem:
await metaRetriever.SetDataSourceAsync(mediaItem.MediaUri);
break;
default:
await metaRetriever.SetDataSourceAsync(mediaItem.MediaUri, RequestHeaders);
break;
}

switch (mediaItem.MediaLocation)
return await ExtractMediaInfo(metaRetriever, mediaItem).ConfigureAwait(false);
}
catch
{
case MediaLocation.Embedded:
case MediaLocation.FileSystem:
await metaRetriever.SetDataSourceAsync(mediaItem.MediaUri);
break;
default:
await metaRetriever.SetDataSourceAsync(mediaItem.MediaUri, RequestHeaders);
break;

}

return await ExtractMediaInfo(metaRetriever, mediaItem).ConfigureAwait(false);
return mediaItem;
}

protected virtual async Task<IMediaItem> ExtractMediaInfo(MediaMetadataRetriever mediaMetadataRetriever, IMediaItem mediaItem)
Expand Down

0 comments on commit 09b7f35

Please sign in to comment.