Esempio n. 1
0
        public override async void Execute(object parameter)
        {
            var items = (ObservableCollection <IVLCStorageItem>)parameter;
            var files = new List <VLCStorageFile>();

            foreach (var item in items)
            {
                var file = item as VLCStorageFile;
                if (file == null)
                {
                    continue;
                }

                if (file.Media != null || VLCFileExtensions.Supported.Contains((file.StorageItem as StorageFile)?.FileType.ToLower()))
                {
                    files.Add((VLCStorageFile)item);
                }
            }
            var playlist = new SmartCollection <IMediaItem>();

            foreach (var file in files)
            {
                if (VLCFileExtensions.AudioExtensions.Contains((file.StorageItem as StorageFile)?.FileType.ToLower()))
                {
                    var trackItem = await Locator.MediaLibrary.GetTrackItemFromFile(file.StorageItem as StorageFile);

                    playlist.Add(trackItem);
                }
                else if (VLCFileExtensions.VideoExtensions.Contains((file.StorageItem as StorageFile)?.FileType.ToLower()))
                {
                    var video = await MediaLibraryHelper.GetVideoItem(file.StorageItem as StorageFile);

                    playlist.Add(video);
                }
                else
                {
                    var stream = MediaLibraryHelper.GetStreamItem(file);
                    playlist.Add(stream);
                }
            }
            if (playlist.Count > 0)
            {
                Locator.NavigationService.GoOnPlaybackStarted(VLCPage.MusicPlayerPage);
                await Locator.PlaybackService.SetPlaylist(playlist);
            }
        }
Esempio n. 2
0
        public override async Task NavigateTo(IVLCStorageItem storageItem)
        {
            var item = storageItem as VLCStorageFolder;

            if (item != null)
            {
                BackStack.Add(item);
                await GetFiles();
            }
            else
            {
                var file = storageItem as VLCStorageFile;
                // TODO : Difference between audio and video, here ? Hint: i don't think so
                var video = MediaLibraryHelper.GetStreamItem(file);
                await Locator.PlaybackService.SetPlaylist(new List <IMediaItem> {
                    video
                });
            }
            OnPropertyChanged(nameof(CurrentFolderName));
        }