Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: chrome/test/data/media/media_source_utils.js

Issue 54053007: Update media tests to unprefixed MSE API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: naming nits Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/test/data/media/mse_config_change.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 function loadMediaFromURL(video) { 5 function loadMediaFromURL(video) {
6 installTitleEventHandler(video, 'error'); 6 installTitleEventHandler(video, 'error');
7 video.addEventListener('playing', function(event) { 7 video.addEventListener('playing', function(event) {
8 console.log('Video Playing.'); 8 console.log('Video Playing.');
9 }); 9 });
10 var source = loadMediaSource(QueryString.mediafile, QueryString.mediatype); 10 var source = loadMediaSource(QueryString.mediafile, QueryString.mediatype);
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 doAppend(mediaFiles[i], srcBuffer); 38 doAppend(mediaFiles[i], srcBuffer);
39 } 39 }
40 } 40 }
41 41
42 function doAppend(mediaFile, srcBuffer) { 42 function doAppend(mediaFile, srcBuffer) {
43 var xhr = new XMLHttpRequest(); 43 var xhr = new XMLHttpRequest();
44 xhr.open('GET', mediaFile); 44 xhr.open('GET', mediaFile);
45 xhr.responseType = 'arraybuffer'; 45 xhr.responseType = 'arraybuffer';
46 xhr.addEventListener('load', function(e) { 46 xhr.addEventListener('load', function(e) {
47 console.log('Appending to buffer ' + mediaFile); 47 var onUpdateEnd = function(e) {
48 srcBuffer.append(new Uint8Array(e.target.response)); 48 console.log('End of appending buffer from ' + mediaFile);
49 totalAppended++; 49 srcBuffer.removeEventListener('updateend', onUpdateEnd);
50 if (totalAppended == mediaFiles.length) { 50 totalAppended++;
51 if (appendSourceCallbackFn) 51 if (totalAppended == mediaFiles.length) {
52 appendSourceCallbackFn(mediaSource); 52 if (appendSourceCallbackFn)
53 else 53 appendSourceCallbackFn(mediaSource);
54 mediaSource.endOfStream(); 54 else
55 } 55 mediaSource.endOfStream();
56 }
57 };
58 srcBuffer.addEventListener('updateend', onUpdateEnd);
59 srcBuffer.appendBuffer(new Uint8Array(e.target.response));
56 }); 60 });
57 xhr.send(); 61 xhr.send();
58 } 62 }
59 63
60 var mediaSource = new WebKitMediaSource(); 64 var mediaSource = new MediaSource();
61 mediaSource.addEventListener('webkitsourceopen', onSourceOpen); 65 mediaSource.addEventListener('sourceopen', onSourceOpen);
62 return mediaSource; 66 return mediaSource;
63 } 67 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/media/mse_config_change.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698