-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMediaAdapter.java
More file actions
31 lines (26 loc) · 797 Bytes
/
MediaAdapter.java
File metadata and controls
31 lines (26 loc) · 797 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
package adapter_pattern;
/**
* @ClassName MediaAdapter
* @Description TODO
* @Author qulingxiao
* @Date 2020/7/26 9:39
* @Version 1.0
*/
public class MediaAdapter implements MediaPlayer {
AdvancedMediaPlayer advancedMediaPlayer;
public MediaAdapter(String audioType){
if(audioType.equalsIgnoreCase("vlc")){
advancedMediaPlayer = new VlcPlayer();
}else if(audioType.equalsIgnoreCase("mp4")){
advancedMediaPlayer = new Mp4Player();
}
}
@Override
public void paly(String audioType, String fileName) {
if(audioType.equalsIgnoreCase("vlc")){
advancedMediaPlayer.playVlc(fileName);
}else if(audioType.equalsIgnoreCase("mp4")){
advancedMediaPlayer.playMp4(fileName);
}
}
}