-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMediaAdapter.cs
More file actions
38 lines (35 loc) · 894 Bytes
/
MediaAdapter.cs
File metadata and controls
38 lines (35 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using AdapterPattern.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AdapterPattern.Concrete
{
public class MediaAdapter : IMediaPlayer
{
IAdvancedMediaPlayer _amp;
public MediaAdapter(string audioType)
{
if (audioType.EndsWith("video"))
{
_amp = new VideoPlayer();
}
else if (audioType.EndsWith("mp4"))
{
_amp = new Mp4Player();
}
}
public void Play(string audioType, string fileName)
{
if (audioType.EndsWith("video"))
{
_amp.PlayVideo(fileName);
}
else if (audioType.EndsWith("mp4"))
{
_amp.PlayVideo(fileName);
}
}
}
}