public void Play(string fileName) { string fileExtension = fileName.Substring(fileName.LastIndexOf('.') + 1); if (fileExtension.Equals("mp3")) { MP3MediaPlayer mP3MediaPlayer = new MP3MediaPlayer(); mP3MediaPlayer.Play(fileName); } else { MediaAdapter mediaAdapter = new MediaAdapter(); mediaAdapter.Play(fileName); } }
public void Play(string FileType, string FileName) { if (FileType == "mp3") { Console.WriteLine("Playing mp3: " + FileName); } else if (FileType == "mp4" || FileType == "vlc") { mediaAdapter = new MediaAdapter(FileType); mediaAdapter.Play(FileType, FileName); } else { Console.WriteLine("Invalid File Type"); } }
public void Play(string audioType, string file) { if (audioType == "mp3") { Console.WriteLine("Playing mp3 file: " + file); } else if (audioType == "vlc" || audioType == "mp4") { adapter = new MediaAdapter(audioType); adapter.Play(audioType, file); } else { Console.WriteLine("Invalid media. " + audioType + " format not supported!"); } }