namespace UMP.Services { public abstract class Video { /// /// Gets the video title. /// public abstract string Title { get; } /// /// Gets the download URL. /// public abstract string Url { get; } /// /// Gets the video type (container). /// public virtual VideoFormat VideoFormat { get { return VideoFormat.Unknown; } } /// /// Gets the audio type (encoding). /// public virtual AudioFormat AudioFormat { get { return AudioFormat.Unknown; } } /*public virtual Task GetUriAsync() => Task.FromResult(Uri); public byte[] GetBytes() => GetBytesAsync().GetAwaiter().GetResult(); public async Task GetBytesAsync() { using (var client = new VideoClient()) { return await client .GetBytesAsync(this) .ConfigureAwait(false); } } public Stream Stream() => StreamAsync().GetAwaiter().GetResult(); public async Task StreamAsync() { using (var client = new VideoClient()) { return await client .StreamAsync(this) .ConfigureAwait(false); } }*/ /// /// Gets the audio extension. /// /// The audio extension, or empty if the audio extension is unknown. public string AudioExtension { get { switch (AudioFormat) { case AudioFormat.Mp3: return ".mp3"; case AudioFormat.Aac: return ".aac"; case AudioFormat.Vorbis: return ".ogg"; case AudioFormat.Opus: return ".opus"; default: return string.Empty; } } } /// /// Gets the video extension. /// /// The video extension, or empty if the video extension is unknown. public virtual string VideoExtension { get { switch (VideoFormat) { case VideoFormat.Mp4: return ".mp4"; case VideoFormat.WebM: return ".webm"; case VideoFormat.Mobile: return ".3gp"; case VideoFormat.Flv: return ".flv"; default: return string.Empty; } } } public override string ToString() { return string.Format("Title: {0}, Url: {1}, VideoFormat: {2}, AudioFormat: {3}", Title, Url, VideoFormat, AudioFormat); } } }