4 <title>EME playback test application
</title>
6 <body style='font-family:
"Lucida Console", Monaco, monospace; font-size:
14px'
onload=
"start()">
7 <i>Clearkey works only with content encrypted using bear key.
</i><br><br>
9 <tr title='URL param mediaFile=...'
>
10 <td><label for='mediaFile'
>Encrypted video URL:
</label></td>
11 <td><input id='mediaFile' type='text' size='
64'
></td>
13 <tr title='URL param licenseServerURL=...'
>
14 <td><label for='licenseServer'
>License sever URL:
</label></td>
15 <td><input id='licenseServer' type='text' size='
64'
></td>
17 <tr title='URL param keySystem=...'
>
18 <td><label for='keySystemList'
>Key system:
</label></td>
19 <td><select id='keySystemList'
></select></td>
21 <tr title='URL param mediaType=...'
>
22 <td><label for='mediaTypeList'
>Media type:
</label></td>
23 <td><select id='mediaTypeList'
></select></td>
25 <tr title='URL param usePrefixedEME=
1|
0'
>
26 <td><label for='usePrefixedEME'
>EME API version:
</label></td>
27 <td><select id='usePrefixedEME'
></select></td>
29 <tr title='URL param useMSE=
1|
0'
>
30 <td><label for='useMSE'
>Load media by:
</label></td>
33 <option value='true' selected='selected'
>MSE
</option>
34 <option value='false'
>src
</option>
40 <button onclick='start();'
>Play
</button>
42 Decoded fps:
<span id='decodedFPS'
></span>
44 Dropped fps:
<span id='droppedFPS'
></span>
46 Total dropped frames:
<span id='droppedFrames'
></span>
50 <td valign='top'
><span id='video'
></span></td>
52 <label for='logs'
onclick=
"toggleDisplay('logs');"><i>Click to toggle logs visibility (newest at top).
</i><br></label>
53 <div id='logs' style='overflow: auto; height:
480px; width:
480px; white-space: nowrap; display: none'
></div>
59 <script src='eme_player_js/app_loader.js' type='text/javascript'
></script>
60 <script type='text/javascript'
>
64 var heartbeatCount
= 0;
67 testConfig
= new TestConfig();
68 testConfig
.loadQueryParams();
69 // Update document with test configuration values.
70 emeApp
= new EMEApp(testConfig
);
71 setInterval(function () {
72 Utils
.timeLog('heartbeat #' + ++heartbeatCount
);
76 function onTimeUpdate(e
) {
78 Utils
.timeLog('timeupdate @ ' + video
.currentTime
);
79 if (video
.currentTime
< 1)
81 // For loadSession() tests, addKey() will not be called after
82 // loadSession() (the key is loaded internally). Do not check keyadded
83 // and renewal message for these tests.
84 if (!testConfig
.sessionToLoad
) {
85 // keyadded may be fired around the start of playback; check for it
86 // after a delay to avoid timing issues.
87 if (testConfig
.usePrefixedEME
&& !video
.receivedKeyAdded
)
88 Utils
.failTest('Key added event not received.');
89 if (testConfig
.keySystem
== EXTERNAL_CLEARKEY
&&
90 !video
.receivedRenewalMessage
)
91 Utils
.failTest('license-renewal message not received.');
93 Utils
.timeLog('waiting for video to end.');
94 video
.removeEventListener('ended', Utils
.failTest
);
95 Utils
.installTitleEventHandler(video
, 'ended');
96 video
.removeEventListener('timeupdate', onTimeUpdate
);
99 function onFirstPlayEnded(e
) {
100 Utils
.timeLog('First play ended.');
101 var video
= e
.target
;
102 video
.removeEventListener('ended', onFirstPlayEnded
);
103 video
.removeEventListener('abort', Utils
.failTest
);
105 // Reset src (to same video again).
106 PlayerUtils
.setVideoSource(player
);
108 // Play the video a second time.
109 Utils
.timeLog('Playing second time.');
113 function play(video
, playTwice
) {
114 Utils
.resetTitleChange();
116 // Wait for the first play to complete.
117 video
.addEventListener('ended', onFirstPlayEnded
);
121 // Ended should not fire before onTimeUpdate.
122 video
.addEventListener('ended', Utils
.failTest
);
123 video
.addEventListener('timeupdate', onTimeUpdate
);
127 function toggleDisplay(id
) {
128 var element
= document
.getElementById(id
);
131 if (element
.style
['display'] != 'none')
132 element
.style
['display'] = 'none';
134 element
.style
['display'] = '';
139 emeApp
.createPlayer()
142 play(player
.video
, testConfig
.playTwice
);
143 }).catch(function(error
) {
144 Utils
.failTest('Unable to play video.');