-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample09.ts
More file actions
33 lines (28 loc) · 852 Bytes
/
example09.ts
File metadata and controls
33 lines (28 loc) · 852 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
class CustomVideoDecoder {
decode(path: string): void {
console.log(`Декодування відео: ${path}`);
}
}
class CustomAudioDecoder {
decode(path: string): void {
console.log(`Декодування аудіо: ${path}`);
}
}
class MediaRenderer {
render(video: void, audio: void): void {
console.log('Рендеринг медіа');
}
}
class MediaPlayer {
private videoDecoder = new CustomVideoDecoder();
private audioDecoder = new CustomAudioDecoder();
private renderer = new MediaRenderer();
play(path: string): void {
const video = this.videoDecoder.decode(path);
const audio = this.audioDecoder.decode(path);
this.renderer.render(video, audio);
}
}
// Використання
const player = new MediaPlayer();
player.play('video.mp4');