public override async Task <IEnumerable <IMediaItem> > GetAll() { var json = ExoPlayerSamples.GetEmbeddedResourceString("media.exolist.json"); var jsonList = ExoPlayerSamples.FromJson(json); IList <IMediaItem> items = new List <IMediaItem>(); foreach (var item in jsonList) { foreach (var sample in item.Samples) { if (!string.IsNullOrEmpty(sample.Uri)) { IMediaItem mediaItem = new MediaItem(sample.Uri) { Title = sample.Name, Album = item.Name, FileExtension = sample.Extension ?? "", ImageUri = "cover_art_placeholder.png", IsMetadataExtracted = true }; mediaItem = await _mediaManager.Extractor.UpdateMediaItem(mediaItem).ConfigureAwait(false); items.Add(mediaItem); } } } return(items); }
public Task <IList <IMediaItem> > GetPlaylist() { var json = ExoPlayerSamples.GetEmbeddedResourceString("media.exolist.json"); var jsonList = ExoPlayerSamples.FromJson(json); IList <IMediaItem> items = new List <IMediaItem>(); foreach (var item in jsonList) { foreach (var sample in item.Samples) { if (!string.IsNullOrEmpty(sample.Uri)) { //TODO: Fix this code in MediaManager /*var mediaItem = await CrossMediaManager.Current.MediaExtractor.CreateMediaItem(sample.Uri); * mediaItem.Title = sample.Name; * mediaItem.Album = item.Name; * mediaItem.FileExtension = sample.Extension ?? "";*/ var mediaItem = new MediaItem(sample.Uri) { Title = sample.Name, Album = item.Name, FileExtension = sample.Extension ?? "" }; if (mediaItem.FileExtension == "mpd" || mediaItem.MediaUri.EndsWith(".mpd")) { mediaItem.MediaType = MediaType.Dash; } else if (mediaItem.FileExtension == "ism" || mediaItem.MediaUri.EndsWith(".ism")) { mediaItem.MediaType = MediaType.SmoothStreaming; } else if (mediaItem.FileExtension == "m3u8" || mediaItem.MediaUri.EndsWith(".m3u8")) { mediaItem.MediaType = MediaType.Hls; } items.Add(mediaItem); } } } return(Task.FromResult(items)); }
public override Task Initialize() { var json = ExoPlayerSamples.GetEmbeddedResourceString("media.exolist.json"); var list = ExoPlayerSamples.FromJson(json); foreach (var item in list) { foreach (var sample in item.Samples) { if (!string.IsNullOrEmpty(sample.Uri)) { var mediaItem = new MediaItem(sample.Uri) { Title = sample.Name, Album = item.Name, FileExtension = sample.Extension ?? "" }; if (mediaItem.FileExtension == "mpd" || mediaItem.MediaUri.EndsWith(".mpd")) { mediaItem.MediaType = MediaType.Dash; } else if (mediaItem.FileExtension == "ism" || mediaItem.MediaUri.EndsWith(".ism")) { mediaItem.MediaType = MediaType.SmoothStreaming; } else if (mediaItem.FileExtension == "m3u8" || mediaItem.MediaUri.EndsWith(".m3u8")) { mediaItem.MediaType = MediaType.Hls; } Items.Add(mediaItem); } } } return(base.Initialize()); }