w3c / media-source

Media Source Extensions
https://w3c.github.io/media-source/
Other
268 stars 58 forks source link

How to use remove specific time slices of media from SourceBuffer using .remove() and or .appendWinodwStart and .appendWindowEnd? #191

Open guest271314 opened 7 years ago

guest271314 commented 7 years ago

Given code which appends multiple buffers to a SourceBuffer, what is the proper procedure to, for example, remove 0 through 30 of the first appended buffer and 5 through 10, in seconds, from the first and second appended buffers, respectively, resulting in playback of the time ranges that are not removed?

jyavenard commented 7 years ago

You can't.

remove is to remove data from a source buffer. Once appendBuffer has completed, you can no longer distinguish the different segments that have been added to a source buffer.

On a side note, this repository is to report issues with the MSE specs. It is not intended for answering generic questions on how to use MSE. There are better platforms for this. Stack overflow is a good one

guest271314 commented 7 years ago

@jyavenard

On a side note, this repository is to report issues with the MSE specs. It is not intended for answering generic questions on how to use MSE.

Asked here to avoid conjecture as to proper usage of the implementations at large based on the specification.

Do advise if should close both this issue and https://github.com/w3c/media-source/issues/190?

guest271314 commented 7 years ago

What is the meaning of

Uncaught DOMException: Failed to set the 'duration' property on 'MediaSource': Setting duration below highest presentation timestamp of any buffered coded frames is disallowed. Instead, first do asynchronous remove(newDuration, oldDuration) on all sourceBuffers, where newDuration < oldDuration.

when trying to set .duration after calling .remove()?

According to the specification at remove

Parameter | Type | Nullable | Optional | Description

start | double | ✘ | ✘ | The start of the removal range, in seconds measured from presentation start time.

end | unrestricted double | ✘ | ✘ | The end of the removal range, in seconds measured from presentation start time.

Is

remove(newDuration, oldDuration) where newDuration < oldDuration

described in the specification as expected parameters for remove()?

What are the expected parameters for .remove(), and what is expected result of .remove() call?

Can the end, start, or newDuration, oldDuration only begin at 0, not for example 5, 10, if more than one ArrayBuffer is appended to a single SourceBuffer?

guest271314 commented 7 years ago

@jyavenard Close to meeting requirement or rendering a stream of media fragments utilizing .appendWindowStart, .appendWindowEnd and .timestampOffset. One issue is setting the properties for buffers 2-N. If the first fragment is ten seconds ten seconds of media is rendered.

How can we reset the above properties so that if 2-N media fragment buffers are not ten seconds, the media playback time of 2-N buffers is not ten seconds?

guest271314 commented 7 years ago

@jyavenard @paulbrucecotton Why does .appendStartWindow not allow setting a value third time? Getting

TypeError: Failed to set the 'appendWindowStart' property on 'SourceBuffer': The value provided (25) is outside the range (0, 5.75].

when previous .appendWindowStart and .appendWindowEnd values were 2.5, 5.75 respectively, and current values trying to set are, for example, 25, 35 https://github.com/legokichi/ts-ebml/issues/14#issuecomment-325277192?

jyavenard commented 7 years ago

@guest271314

TypeError: Failed to set the 'appendWindowStart' property on 'SourceBuffer': The value provided (25) is outside the range (0, 5.75].

The message provided is rather explicit.

appendWindowStart can't be greater than appendWindowEnd https://w3c.github.io/media-source/index.html#dom-sourcebuffer-appendwindowstart "3. If the new value is less than 0 or greater than or equal to appendWindowEnd then throw a TypeError exception and abort these steps."

I strongly suggest that you read the MSE spec, all your answers are there. https://w3c.github.io/media-source/index.html

guest271314 commented 7 years ago

@jyavenard

You can't.

Solved.

Utilized .remove(0, <duration>), then at corresponding dispatched updatedend event set .appendWindowStart to 0 and .appendWindowEnd to Infinity before proceeding to next .appendBuffer() call.

paulbrucecotton commented 7 years ago

Asking for clarification, here. That is the purpose of the this repository at GitHub, yes? Else, why are comments allowed at all if questions concerning implementation are not fielded?

This GitHub was used for the development of the MSE Recommendation. It can certainly be used to propose corrections and improvements to the Recommendation but is not really meant to be an FAQ for MSE.

As indicated elsewhere you might get better help at StackOverflow since there are likely more people watching and/or participating those discussions.

/paulc HME WG Chair

guest271314 commented 7 years ago

@paulbrucecotton Would suggest including a note in the specification which indicates that if .appendWindowStart and .appendWindowEnd are expected to be used more than once for more than a single appended buffer, the values of each should be set to 0, Infinity, respectively, before setting to the values expected to be rendered.

stackoverflow is not the end-all, be-all. A useful service, though if you are here, why not ask the authors and contributors of and to the specification itself?

In any event, nice work on developing MediaSource.

guest271314 commented 7 years ago

@paulbrucecotton

As indicated elsewhere you might get better help at StackOverflow since there are likely more people watching and/or participating those discussions.

fyi have asked the question at stackoverflow.com, at least thrice, from different perspectives

If would have stopped asking questions when first question was closed by stackoverflow users, when previously encountered "can't" at second question, or not continued attempting to meet specific requirement following excellent work by Kaiido at third question, would not have reached fulfillment of media fragment portion of requirement using MediaSource and resolved media recording portion of requirement using ts-ebml.

wolenetz commented 4 years ago

Looks like V2BugFixes is best milestone for now to help ensure this issue gets appropriate attention in V2 scope.

guest271314 commented 4 years ago

Including a minimal example of remove(), appendWindowStart, and appendWindowEnd usage in the specification would resolve this issue.