public PlayableItem Create(Video video) { PlayableItem playable = null; if (PlayableExternal.CanPlay(video.Path)) playable = new PlayableExternal(video.Path); else if (PlayableVideoFile.CanPlay(video)) playable = new PlayableVideoFile(video); else if (PlayableIso.CanPlay(video)) playable = new PlayableIso(video); else if (PlayableMultiFileVideo.CanPlay(video)) playable = new PlayableMultiFileVideo(video); else if (PlayableDvd.CanPlay(video)) playable = new PlayableDvd(video); foreach (var controller in Kernel.Instance.PlaybackControllers) { if (controller.CanPlay(playable.Filename)) { playable.PlaybackController = controller; } } return playable; }
public PlayableItem Create(Media media) { PlayableItem playable = null; foreach (CanPlay canPlay in PlayableItems.Keys) if (canPlay(media)) { Type type = PlayableItems[canPlay]; playable = (PlayableItem) Activator.CreateInstance(type, media); break; } if (playable == null) playable = new PlayableVideoFile(media); foreach (var controller in Kernel.Instance.PlaybackControllers) { if (controller.CanPlay(playable.Filename)) { playable.PlaybackController = controller; return playable; } } return playable; }