-
Notifications
You must be signed in to change notification settings - Fork 1
/
subtitles-modular.html
166 lines (154 loc) · 5.86 KB
/
subtitles-modular.html
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<html>
<head>
<title>Bitmovin Player Web X</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="#" />
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65"
crossorigin="anonymous"
/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css" />
<!-- Here we load the framework core source file, followed by the packages which compose the player. -->
<script type="text/javascript" src="../node_modules/@bitmovin/player-web-x/bundles/playerx-core.js"></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-capabilities.package.js"
></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-segment-processing.package.js"
></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-container-mp4.package.js"
></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-container-ts.package.js"
></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-ts-transmuxer.package.js"
></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-data.package.js"
></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-network.package.js"
></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-hls-translation.package.js"
></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-hls-parsing.package.js"
></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-hls.package.js"
></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-presentation.package.js"
></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-source.package.js"
></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-sources-api.package.js"
></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-adaptation.package.js"
></script>
<script
type="text/javascript"
src="../node_modules/@bitmovin/player-web-x/packages/playerx-subtitles.package.js"
></script>
<!-- Load the example package files -->
<script type="text/javascript" src="../out/subtitle-format-detection-modify.package.js"></script>
<script type="text/javascript" src="../out/ttml.package.js"></script>
<style>
.container .row {
padding: 1em 0;
}
.form-select {
font-size: 1.4em;
}
.btn-group {
margin-top: 0.5em;
display: flex !important;
}
.logo {
float: left;
margin-right: 1em;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col col-sm">
<img class="logo" src="../static/bitmovin-player-x-gradient.png" width="50" />
<h1>Bitmovin Player Web X Subtitles Demo</h1>
</div>
</div>
<div class="row">
<div class="col-sm">
<div id="player-container"></div>
</div>
</div>
</div>
<script type="text/javascript">
/**
* Instantiate the framework
*/
const Player = bitmovin.playerx.Player;
const player = Player({
key: 'YOUR-PLAYER-KEY',
defaultContainer: document.getElementById('player-container'),
playback: {
autoplay: true,
muted: true,
},
});
/**
* Load the player packages into the framework.
*/
console.log('adding packages');
player.packages.add(bitmovin.playerx['capabilities'].default);
player.packages.add(bitmovin.playerx['segment-processing'].default);
player.packages.add(bitmovin.playerx['container-mp4'].default);
player.packages.add(bitmovin.playerx['container-ts'].default);
player.packages.add(bitmovin.playerx['ts-transmuxer'].default);
player.packages.add(bitmovin.playerx['data'].default);
player.packages.add(bitmovin.playerx['network'].default);
player.packages.add(bitmovin.playerx['hls-translation'].default);
player.packages.add(bitmovin.playerx['hls-parsing'].default);
player.packages.add(bitmovin.playerx['hls'].default);
player.packages.add(bitmovin.playerx['presentation'].default);
player.packages.add(bitmovin.playerx['source'].default);
player.packages.add(bitmovin.playerx['sources-api'].default);
player.packages.add(bitmovin.playerx['adaptation'].default);
// Add subtitle packages
player.packages.add(bitmovin.playerx['subtitles'].default);
// Adding custom format detection package
player.packages.add(bitmovin.playerx['subtitle-format-detection-modify'].default);
// Add ttml parser package - it has no real implementation yet
player.packages.add(bitmovin.playerx['ttml'].default);
// Current source has WebVTT subtitles
const sourceApi = player.sources.add(
{ resources: [{ url: 'https://cdn.bitmovin.com/content/assets/sintel/hls/playlist.m3u8' }] },
{ attach: true, playback: { autoplay: true, muted: true } },
);
sourceApi.logLevel = 1e9;
</script>
</body>
</html>