Skip to content

Commit

Permalink
Merge pull request Baseflow#700 from muhaym/develop
Browse files Browse the repository at this point in the history
Fixed Logic for GetFrame
  • Loading branch information
martijn00 authored Apr 15, 2020
2 parents 5038344 + 743a030 commit b5e6063
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public Task<object> ProvideVideoFrame(IMediaItem mediaItem, TimeSpan timeFromSta
{
var metadataRetriever = CreateMediaRetriever(mediaItem);

var bitmap = metadataRetriever.GetFrameAtTime((long)timeFromStart.TotalMilliseconds);
var bitmap = metadataRetriever.GetFrameAtTime((long)(timeFromStart.TotalMilliseconds * 1000));

metadataRetriever.Release();
return Task.FromResult(bitmap as object);
Expand Down
2 changes: 1 addition & 1 deletion MediaManager/Platforms/Android/Media/ID3Provider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public async Task<object> ProvideVideoFrame(IMediaItem mediaItem, TimeSpan timeF
{
var metadataRetriever = await CreateMediaRetriever(mediaItem).ConfigureAwait(false);

image = metadataRetriever.GetFrameAtTime((long)timeFromStart.TotalMilliseconds);
image = metadataRetriever.GetFrameAtTime((long)(timeFromStart.TotalMilliseconds*1000));

metadataRetriever.Release();
}
Expand Down
2 changes: 1 addition & 1 deletion MediaManager/Platforms/Apple/Media/AVAssetProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Task<object> ProvideVideoFrame(IMediaItem mediaItem, TimeSpan timeFromSta
var url = mediaItem.GetNSUrl();
var imageGenerator = new AVAssetImageGenerator(AVAsset.FromUrl(url));
imageGenerator.AppliesPreferredTrackTransform = true;
var cgImage = imageGenerator.CopyCGImageAtTime(new CMTime((long)timeFromStart.TotalMilliseconds, 1000000), out var actualTime, out var error);
var cgImage = imageGenerator.CopyCGImageAtTime(new CMTime((long)timeFromStart.TotalMilliseconds, 1000), out var actualTime, out var error);
return Task.FromResult(cgImage as object);
}
}
Expand Down

0 comments on commit b5e6063

Please sign in to comment.