Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose SourceBuffer as an ArrayBuffer #209

Open
guest271314 opened this issue Mar 23, 2018 · 7 comments
Open

Expose SourceBuffer as an ArrayBuffer #209

guest271314 opened this issue Mar 23, 2018 · 7 comments
Labels
feature request TPAC-2022-discussion Marked for discussion at TPAC 2022 Media WG meeting Sep 16
Milestone

Comments

@guest271314
Copy link

Currently there does not appear to be any means to get the media accumulated at a SourceBuffer at any time (w3c/html#550, w3c/html#555).

Provide some means of getting the media resource as a file (Blob having MIME type set the the codec set at MediaSource/SourceBuffer; ArrayBuffer) (ideally at any time, before .endOfStream() is called) at least when .endOfStream() is called.

@jyavenard
Copy link
Member

What meaningful data do you expect to see in return?
That's fine if you've only added the same content.

But if you've added different init segment, overwritten others, added multiple init segments for different resolution/encoding.

What then?

@guest271314
Copy link
Author

Not having viewed what a SourceBuffer following .endOfStream() looks like, am not sure what to expect.

What am relatively certain of now is that the accumulated data is not retrievable at .srcObject, nor any other way that have tried.

Would naively anticipate that a file having the MIME type equaling the codecs passed to MediaSource and .addSourceBuffer would be either be already assembled or capable of being assembled from the ArrayBuffers passed prior to calling .endOfStream().

The media can be seeked, and has a total duration at a <video> element following .endOfStream() - that accumulated data should be available as a discrete file object (ArrayBuffer; Blob).

The specification states

These URLs are the same as a Blob URI, except that anything in the definition of that feature that refers to File and Blob objects is hereby extended to also apply to MediaSource objects.

though the clear, unambiguous interpretation of that sentence, if accurate, would not have lead to this issue being filed - as a developer cannot request the Blob URL and get the data created by MediaSource object; instead 404 is response or 416 Range Not Satisfiable when trying to use the Blob URL in the same way as a Blob URL with Blob backing.

Is there a reason the SourceBuffer is not exposed?

@guest271314
Copy link
Author

The reason for this issue is that although have no experience using C++ browsed Chromium source code relevant to MediaSource and cannot locate where the data is stored.

Am trying to find a way to resolve #190 at Chromium, which still crashes the tab when trying to record a <video> element with HTMLMediaElement.captureStream(). Looking into the matter further is what led to w3c/html#550 and w3c/html#555.

The accumulated data is stored somewhere (https://beaufortfrancois.github.io/sandbox/media/source-buffer-limit.html). That data should be exposed to developers.

Am not sure if the original specification anticipated recording a <video> element where MediaSource is set at .src, though Firefox does not have an issue recording the media. If we have access to the accumulated data we might not need to use MediaRecorder at all - the data is already configured to be rendered at a <video> element.

If the decision is made to merge this issue with #190, that is fine.

@guest271314
Copy link
Author

Is 1.2 Definitions accurate as to the second paragraph below?

MediaSource object URL
A MediaSource object URL is a unique Blob URI [FILE-API] created by createObjectURL(). It is used to attach a MediaSource object to an HTMLMediaElement.

These URLs are the same as a Blob URI [FILE-API], except that anything in the definition of that feature that refers to File and Blob objects is hereby extended to also apply to MediaSource objects.

@guest271314
Copy link
Author

@wolenetz When endOfStream() is executed can the SourceBuffer be exposed as an ArrayBuffer. Consider using changeType() to play variable resolution WebM videos. Currently due to a Chromium bug there is no way to record the <video> element using captureStream() without the tab crashing https://bugs.chromium.org/p/chromium/issues/detail?id=1001948 (likely the reason for the crash described at #190, et al.).

If SourceBuffer could be converted ideally to a WebM file available for download when the stream is complete that would be a viable workaround for using MediaRecorder.

What exactly is the data structure of a SourceBuffer when endOfStream() is called?

Is there any reason in the speification why a <video> with MediaSource set at src is restricted from being downloaded by the browser?

@guest271314
Copy link
Author

@wolenetz

Currently due to a Chromium bug there is no way to record the

Except using "video/webm;codecs=h264|avc1" or "video/x-matroska;codecs=h264|avc1" (https://plnkr.co/edit/Axkb8s?p=info) which are not capable of playback at Mozilla browsers.

@mwatson2 mwatson2 added this to the Backlog milestone Sep 21, 2020
@mwatson2 mwatson2 added agenda Topic should be discussed in a group call and removed agenda Topic should be discussed in a group call labels Sep 21, 2020
@wolenetz wolenetz added the TPAC-2022-discussion Marked for discussion at TPAC 2022 Media WG meeting Sep 16 label Sep 16, 2022
@wolenetz
Copy link
Member

This issue is part of a group of "introspection API" or similar API feature requests: #259, #209, #172, #40, #35.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request TPAC-2022-discussion Marked for discussion at TPAC 2022 Media WG meeting Sep 16
Projects
None yet
Development

No branches or pull requests

4 participants