@@ -76,6 +76,32 @@ describe('LCEVC Integration', () => {
76
76
document . body . removeChild ( canvas ) ;
77
77
} ) ;
78
78
79
+ /**
80
+ * @param {string } uri
81
+ * @return {!Promise }
82
+ */
83
+ async function testPlayback ( uri ) {
84
+ // Wait for LCEVCdec to finish loading
85
+ await LCEVCdec . ready ;
86
+
87
+ await player . load ( seiManifests . FMP4_DASH ) ;
88
+ await video . play ( ) ;
89
+
90
+ // Wait for the video to start playback. If it takes longer than 10
91
+ // seconds, fail the test.
92
+ await waiter . waitForMovementOrFailOnTimeout ( video , 10 ) ;
93
+
94
+ // Play for 6 seconds, but stop early if the video ends. If it takes
95
+ // longer than 45 seconds, fail the test.
96
+ await waiter . waitUntilPlayheadReachesOrFailOnTimeout ( video , 6 , 45 ) ;
97
+
98
+ // Expect LCEVCdec to be enabled and have detected LCEVC data in SEI
99
+ expect ( LCEVCdec . instance ) . toBeDefined ( ) ;
100
+ expect ( LCEVCdec . instance . isLcevcEnabled ) . toBe ( true ) ;
101
+ expect ( LCEVCdec . instance . firstLcevcSegmentLoaded ) . toBe ( true ) ;
102
+ expect ( LCEVCdec . instance . lcevcDataDetected ) . toBe ( true ) ;
103
+ }
104
+
79
105
describe ( 'SEI Integration' , ( ) => {
80
106
it ( 'Should decode LCEVC in FMP4 DASH manifest' , async ( ) => {
81
107
if ( shaka . util . Platform . isTizen ( ) || shaka . util . Platform . isChromecast ( ) ) {
@@ -87,25 +113,7 @@ describe('LCEVC Integration', () => {
87
113
pending ( 'Current platform does not offer WebGL support.' ) ;
88
114
}
89
115
90
- // Wait for LCEVCdec to finish loading
91
- await LCEVCdec . ready ;
92
-
93
- await player . load ( seiManifests . FMP4_DASH ) ;
94
- await video . play ( ) ;
95
-
96
- // Wait for the video to start playback. If it takes longer than 10
97
- // seconds, fail the test.
98
- await waiter . waitForMovementOrFailOnTimeout ( video , 10 ) ;
99
-
100
- // Play for 6 seconds, but stop early if the video ends. If it takes
101
- // longer than 45 seconds, fail the test.
102
- await waiter . waitUntilPlayheadReachesOrFailOnTimeout ( video , 6 , 45 ) ;
103
-
104
- // Expect LCEVCdec to be enabled and have detected LCEVC data in SEI
105
- expect ( LCEVCdec . instance ) . toBeDefined ( ) ;
106
- expect ( LCEVCdec . instance . isLcevcEnabled ) . toBe ( true ) ;
107
- expect ( LCEVCdec . instance . firstLcevcSegmentLoaded ) . toBe ( true ) ;
108
- expect ( LCEVCdec . instance . lcevcDataDetected ) . toBe ( true ) ;
116
+ await testPlayback ( seiManifests . FMP4_DASH ) ;
109
117
} ) ;
110
118
111
119
it ( 'Should decode LCEVC in FMP4 HLS manifest' , async ( ) => {
@@ -118,25 +126,7 @@ describe('LCEVC Integration', () => {
118
126
pending ( 'Current platform does not offer WebGL support.' ) ;
119
127
}
120
128
121
- // Wait for LCEVCdec to finish loading
122
- await LCEVCdec . ready ;
123
-
124
- await player . load ( seiManifests . FMP4_HLS ) ;
125
- await video . play ( ) ;
126
-
127
- // Wait for the video to start playback. If it takes longer than 10
128
- // seconds, fail the test.
129
- await waiter . waitForMovementOrFailOnTimeout ( video , 10 ) ;
130
-
131
- // Play for 6 seconds, but stop early if the video ends. If it takes
132
- // longer than 45 seconds, fail the test.
133
- await waiter . waitUntilPlayheadReachesOrFailOnTimeout ( video , 6 , 45 ) ;
134
-
135
- // Expect LCEVCdec to be enabled and have detected LCEVC data in SEI
136
- expect ( LCEVCdec . instance ) . toBeDefined ( ) ;
137
- expect ( LCEVCdec . instance . isLcevcEnabled ) . toBe ( true ) ;
138
- expect ( LCEVCdec . instance . firstLcevcSegmentLoaded ) . toBe ( true ) ;
139
- expect ( LCEVCdec . instance . lcevcDataDetected ) . toBe ( true ) ;
129
+ await testPlayback ( seiManifests . FMP4_HLS ) ;
140
130
} ) ;
141
131
142
132
it ( 'Should decode LCEVC in TS HLS manifest' , async ( ) => {
@@ -149,25 +139,7 @@ describe('LCEVC Integration', () => {
149
139
pending ( 'Current platform does not offer WebGL support.' ) ;
150
140
}
151
141
152
- // Wait for LCEVCdec to finish loading
153
- await LCEVCdec . ready ;
154
-
155
- await player . load ( seiManifests . TS_HLS ) ;
156
- await video . play ( ) ;
157
-
158
- // Wait for the video to start playback. If it takes longer than 10
159
- // seconds, fail the test.
160
- await waiter . waitForMovementOrFailOnTimeout ( video , 10 ) ;
161
-
162
- // Play for 6 seconds, but stop early if the video ends. If it takes
163
- // longer than 45 seconds, fail the test.
164
- await waiter . waitUntilPlayheadReachesOrFailOnTimeout ( video , 6 , 45 ) ;
165
-
166
- // Expect LCEVCdec to be enabled and have detected LCEVC data in SEI
167
- expect ( LCEVCdec . instance ) . toBeDefined ( ) ;
168
- expect ( LCEVCdec . instance . isLcevcEnabled ) . toBe ( true ) ;
169
- expect ( LCEVCdec . instance . firstLcevcSegmentLoaded ) . toBe ( true ) ;
170
- expect ( LCEVCdec . instance . lcevcDataDetected ) . toBe ( true ) ;
142
+ await testPlayback ( seiManifests . TS_HLS ) ;
171
143
} ) ;
172
144
} ) ;
173
145
} ) ;
0 commit comments