Authors:
Yinghua Zhang<yingh.zhang@samsung.com>
+ Mengli Zhang<mengli.zhang@samsung.com>
-->
<html>
onGetBufferArray = t.step_func(function(uint8Array) {
audioSourceBuffer.timestampOffset = 5;
audioSourceBuffer.appendBuffer(uint8Array);
- audioSourceBuffer.abort();
- audioSourceBuffer.timestampOffset = 0;
- audioSourceBuffer.appendBuffer(uint8Array);
- setTimeout(function(){
- assert_equals(audioSourceBuffer.buffered.length, 1, 'Source buffer number');
- assert_equals(audioSourceBuffer.buffered.start(0), 0, 'Range start');
- assert_approx_equals(audioSourceBuffer.buffered.end(0), 16.4, 'Range end');
- t.done();
- },0);
+ audioSourceBuffer.addEventListener('update', function() {
+ audioSourceBuffer.abort();
+ audioSourceBuffer.timestampOffset = 0;
+ audioSourceBuffer.appendBuffer(uint8Array);
+ setTimeout(function(){
+ assert_equals(audioSourceBuffer.buffered.length, 1, 'Source buffer number');
+ assert_equals(audioSourceBuffer.buffered.start(0), 0, 'Range start');
+ assert_approx_equals(audioSourceBuffer.buffered.end(0), 17.42, 'Range end');
+ t.done();
+ },0);
+ });
});
sourceopenCallback = t.step_func(function (event){
Authors:
Yinghua Zhang<yingh.zhang@samsung.com>
+ Mengli Zhang<mengli.zhang@samsung.com>
-->
<html>
t.step(function() {
onTimeOut = t.step_func(function (event){
- assert_approx_equals(audioSourceBuffer.buffered.end(0), 8.15, 'Range end');
+ assert_approx_equals(audioSourceBuffer.buffered.end(0), 12.42, 'Range end');
assert_equals(audioSourceBuffer.buffered.start(0), 0, 'Range start');
assert_equals(audioSourceBuffer.buffered.length, 1, 'Source buffer number');
t.done();
onGetBufferArray = t.step_func(function(uint8Array) {
audioSourceBuffer.appendBuffer(uint8Array);
- audioSourceBuffer.abort();
- setTimeout(onTimeOut, 0);
- audioSourceBuffer.appendBuffer(uint8Array);
+ audioSourceBuffer.addEventListener('update', function() {
+ audioSourceBuffer.abort();
+ setTimeout(onTimeOut, 0);
+ audioSourceBuffer.appendBuffer(uint8Array);
+ });
});
sourceopenCallback = t.step_func(function (event){
Authors:
Jingbiao Nan<jingbiao.nan@samsung.com>
+ Mengli Zhang<mengli.zhang@samsung.com>
-->
<html>
setup({timeout: 180000});
var t = async_test(document.title, {timeout: 180000}), mediaSource, video,
-sourceopenCallback, onDurationChanged, sourceBuffer, onGetBufferArray;
+sourceopenCallback, onDurationChanged, sourceBuffer, onGetBufferArray, updateCb;
t.step(function() {
onDurationChanged = t.step_func(function(uint8Array) {
t.done();
});
- onGetBufferArray = t.step_func(function(uint8Array) {
- sourceBuffer.appendBuffer(uint8Array);
+ updateCb = t.step_func(function(uint8Array) {
setTimeout(function(){
sourceBuffer.abort();
video.addEventListener('durationchange', onDurationChanged);
}, 0);
});
+ onGetBufferArray = t.step_func(function(uint8Array) {
+ sourceBuffer.appendBuffer(uint8Array);
+ });
+
sourceopenCallback = t.step_func(function (event){
sourceBuffer = mediaSource.addSourceBuffer(AUDIO_TYPE);
+ sourceBuffer.addEventListener('update', updateCb);
GET_MEDIA(AUDIO_1_MB, onGetBufferArray);
});
Authors:
Jingbiao Nan<jingbiao.nan@samsung.com>
+ Mengli Zhang<mengli.zhang@samsung.com>
-->
<html>
setup({timeout: 180000});
var t = async_test(document.title, {timeout: 180000}), mediaSource, video,
-sourceopenCallback, onDurationChanged, sourceBuffer, onGetBufferArray;
+sourceopenCallback, onDurationChanged, sourceBuffer, onGetBufferArray, updateCb;
t.step(function() {
onDurationChanged = t.step_func(function(uint8Array) {
onGetBufferArray = t.step_func(function(uint8Array) {
sourceBuffer.appendBuffer(uint8Array);
+ });
+ updateCb = t.step_func(function(uint8Array) {
setTimeout(function(){
sourceBuffer.abort();
video.addEventListener('durationchange', onDurationChanged);
sourceopenCallback = t.step_func(function (event){
sourceBuffer = mediaSource.addSourceBuffer(VIDEO_TYPE);
+ sourceBuffer.addEventListener('update', updateCb);
GET_MEDIA(VIDEO_TEST, onGetBufferArray);
});
Authors:
Yinghua Zhang<yingh.zhang@samsung.com>
+ Mengli Zhang<mengli.zhang@samsung.com>
-->
<html>
setup({timeout: 30000});
var t = async_test(document.title, {timeout: 30000}), mediaSource, video, onMetadataLoad,
-sourceopenCallback, videoSourceBuffer, onGetVideoBufferArray, onTimeOut, onTimeupdate;
+sourceopenCallback, videoSourceBuffer, onGetVideoBufferArray, onTimeOut, onTimeupdate, updateCb;
t.step(function() {
onTimeupdate = t.step_func(function (){
video.play();
});
- onGetVideoBufferArray = t.step_func(function(uint8Array) {
- videoSourceBuffer.appendBuffer(uint8Array);
+ updateCb = t.step_func(function(uint8Array) {
setTimeout(t.step_func(function(){
assert_equals(videoSourceBuffer.buffered.start(0), 0, 'Range start');
assert_equals(videoSourceBuffer.buffered.length, 1, 'Source buffer number');
}), 0);
});
+ onGetVideoBufferArray = t.step_func(function(uint8Array) {
+ videoSourceBuffer.appendBuffer(uint8Array);
+ });
+
sourceopenCallback = t.step_func(function (event){
videoSourceBuffer = mediaSource.addSourceBuffer(VIDEO_TYPE);
+ videoSourceBuffer.addEventListener('update', updateCb);
GET_MEDIA(VIDEO_TEST, onGetVideoBufferArray);
});
t.step(function() {
onGetBufferArray = t.step_func(function(uint8Array) {
sourceBuffer.appendBuffer(uint8Array);
- setTimeout(t.step_func(function(){
- sourceBuffer.abort();
- mediaSource.duration = 5;
- assert_equals(mediaSource.duration, 5, "mediaSource duration should be 5.");
- setTimeout(function(){
- assert_equals(video.duration, 5, "video duration should be 5.");
- t.done();
- }, 0);
- }), 0);
-
});
+ var updateCb = function() {
+ sourceBuffer.abort();
+ mediaSource.duration = 5;
+ assert_equals(mediaSource.duration, 5, "mediaSource duration should be 5.");
+ setTimeout(function(){
+ assert_equals(video.duration, 5, "video duration should be 5.");
+ t.done();
+ }, 0);
+ }
+
sourceopenCallback = t.step_func(function (event){
sourceBuffer = mediaSource.addSourceBuffer(AUDIO_TYPE);
+ sourceBuffer.addEventListener('update', updateCb);
GET_MEDIA(AUDIO_1_MB, onGetBufferArray);
});
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'arraybuffer';
+ xhr.setRequestHeader('Range', 'bytes=0-' + (200000 - 1));
xhr.send();
xhr.onload = function(e) {