void GetMetaData(global::Android.Net.Uri uri, IDictionary <string, string> headers) { Task.Run(() => { var retriever = new MediaMetadataRetriever(); if (uri.Scheme != null && uri.Scheme.StartsWith("http") && headers != null) { try { retriever.SetDataSource(uri.ToString(), headers); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } } else { retriever.SetDataSource(Context, uri); } ExtractMetadata(retriever); MetadataRetrieved?.Invoke(this, EventArgs.Empty); }); }
public override void SetVideoPath(string path) { base.SetVideoPath(path); if (System.IO.File.Exists(path)) { var retriever = new MediaMetadataRetriever(); Task.Run(() => { retriever.SetDataSource(path); ExtractMetadata(retriever); MetadataRetrieved?.Invoke(this, EventArgs.Empty); }); } }
protected async Task SetMetadata(global::Android.Net.Uri uri, IDictionary <string, string>?headers) { var retriever = new MediaMetadataRetriever(); if (uri.Scheme != null && uri.Scheme.StartsWith(Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase)) { await retriever.SetDataSourceAsync(uri.ToString(), headers ?? new Dictionary <string, string>()); } else { await retriever.SetDataSourceAsync(Context, uri); } ExtractMetadata(retriever); MetadataRetrieved?.Invoke(this, EventArgs.Empty); }
protected void GetMetaData(global::Android.Net.Uri uri, IDictionary <string, string> headers) { Task.Run(() => { var retriever = new MediaMetadataRetriever(); if (uri.Scheme != null && uri.Scheme.StartsWith("http")) { retriever.SetDataSource(uri.ToString(), headers ?? new Dictionary <string, string>()); } else { retriever.SetDataSource(Context, uri); } ExtractMetadata(retriever); MetadataRetrieved?.Invoke(this, EventArgs.Empty); }); }