ImageSource IVideoUtils.GetVideoThumbnail(string url) { NSUrl videoUrl = NSUrl.CreateFileUrl(url, null); var asset = AVAsset.FromUrl(videoUrl); var imageGenerator = AVAssetImageGenerator.FromAsset(asset); imageGenerator.AppliesPreferredTrackTransform = true; var seconds = asset.Duration.Seconds; CoreMedia.CMTime actualTime; CoreMedia.CMTime cmTime = asset.Duration; var timeScale = asset.Duration.TimeScale; cmTime.Value = (seconds > 5) ? timeScale * 5 : timeScale * 1; NSError error; var imageRef = imageGenerator.CopyCGImageAtTime(cmTime, out actualTime, out error); if (imageRef == null) { return(null); } var uiImage = UIImage.FromImage(imageRef); var img = Xamarin.Forms.ImageSource.FromStream(() => ((uiImage.AsPNG().AsStream()))); return(img); }
public extern static bool bool_objc_msgSendSuper_CMTime_CMTime_CMTime(IntPtr receiver, IntPtr selector, CoreMedia.CMTime arg1, CoreMedia.CMTime arg2, CoreMedia.CMTime arg3);
public extern static bool bool_objc_msgSendSuper_CMTime_float_float_CMTimeRange(IntPtr receiver, IntPtr selector, CoreMedia.CMTime arg1, float arg2, float arg3, CoreMedia.CMTimeRange arg4);
public extern static bool bool_objc_msgSendSuper_CMTime_CGAffineTransform_CGAffineTransform_CMTimeRange(IntPtr receiver, IntPtr selector, CoreMedia.CMTime arg1, CoreGraphics.CGAffineTransform arg2, CoreGraphics.CGAffineTransform arg3, CoreMedia.CMTimeRange arg4);