PPAPI Method |
Assumes Threads |
Emscripten |
Web API |
Limitations |
GetTimestamp |
|
SDL |
AudioBufferSourceNode.start (parameter) |
Passed in each time instead of attached to the buffer. |
SetTimestamp |
|
SDL |
AudioBufferSourceNode.start (parameter) |
|
GetSampleRate |
|
SDL |
AudioBuffer.sampleRate |
|
GetSampleSize |
|
GAP |
GAP - WebAudio only uses 32-bit float, PPAPI does 16-bit int. |
PPAPI theoretically supports multiple sampling sizes. In practice, it only supports 16-bit samples. Unfortunately, developers have requested 16-bit sample sizes to save on memory use. The next version of the Web Audio spec will implement support for 16-bit samples. An optimization for AudioBuffer could be implemented similar to Firefox by using 16-bit buffer for audio that comes from decodeAudioData |
GetNumberOfChannels |
|
SDL |
AudioBuffer.numberOfChannels |
|
GetDataBuffer |
|
SDL |
AudioBuffer.getChannelData |
|
GetBufferSize |
|
SDL |
AudioBuffer.length |
|
PPAPI Method |
Assumes Threads |
Emscripten |
Web API |
Limitations |
CreateStereo16Bit |
|
GAP |
GAP - Only 32-bit float samples supported |
The next version of the Web Audio spec will implement support for 16-bit samples. |
GetSampleRate |
|
SDL |
AudioContext.sampleRate |
|
GetSampleFrameCount |
|
SDL |
AudioBuffer.length |
|
RecommendSampleRate |
|
SDL |
AudioContext.sampleRate (from default construct) |
An AudioContext will have the preferred sampling rate that matchs the actual sample rate of the hardware audio device by default. |
RecommendSampleFrameCount |
|
GAP |
GAP - Would be handled with the planned AudioDeviceClient |
There is an open issue to allow a user-specified size, but that is still being defined. This is probably best handled with AudioDeviceClient which can tell you what the appropriate size would be for the given hardware. |
PPAPI Method |
Assumes Threads |
Emscripten |
Web API |
Limitations |
Create |
|
FS (partial) |
window.chooseFileSystemEntries() |
Create and open are used differently, but the pieces are of equal power. |
Open |
|
FS (partial) |
window.chooseFileSystemEntries() |
|
Query |
|
FS (partial) |
Blob.size, FileSystemHandle.getFile(), FileSystemHandle.getDirectory(), File.lastModified |
GAP (partial) - Blob.type can also be used to check the MIME type. The file system type, creation time, and last access time can not be determined with the Native File System API. |
Touch |
|
FS (partial) |
FileSystemDirectoryHandle.getFile("name", {create: true}) |
|
Read |
|
FS (partial) |
Blob.slice().arrayBuffer() |
|
Write |
|
FS (partial) |
FileSystemWriter.write() |
|
SetLength |
|
FS (partial) |
FileSystemWriter.truncate() |
|
Flush |
|
GAP (partial) |
GAP (partial) - Files are flushed when FileSystemWrite.close() is called |
This is intended by design because the Native File System API files are exposed to the OS, therefore a Safe Browsing check needs to be performed before data is shown to the OS. |
Close |
|
FS (partial) |
FileSystemWriter.close() |
Does not cancel pending operations, but flushes any data written so far to disk. |
ReadToArray |
|
GAP |
Blob.slice().arrayBuffer() or Blob.arrayBuffer() |
Allows multiple subrange reads in parallel. |
PPAPI Method |
Assumes Threads |
Emscripten |
Web API |
Limitations |
Create |
|
FS (partial) |
FileSystemDirectoryHandle.getFile("name", {create: true}) |
|
GetFileSystemType |
|
FS (partial) |
FileSystem.type |
|
GetName |
|
FS (partial) |
File.name |
|
GetPath |
|
FS (partial) |
GAP (partial) - With the Native File System API, the relative path of a file can be determined from reference to a directory that contains the file using FileSystemHandle.resolve(FileSystemHandle) |
The absolute path of a file cannot be determined, and the user has to grant permission to access the directory containing the file. |
GetParent |
|
FS (partial) |
GAP (partial) - With the Native File System API, the relative path of a file can be determined from reference to a directory that contains the file using FileSystemHandle.resolve(FileSystemHandle) |
The user has to grant permission to access the directory containing the file. |
MakeDirectory |
|
FS (partial) |
FileSystemHandle.getDirectory(..., {createIfNotExists: true}) |
|
Touch |
|
FS (partial) |
FileSystemDirectoryHandle.getFile("name", {create: true}) |
Modify time can be bumped by writing. |
Delete |
|
FS (partial) |
FileSystemDirectoryHandle.removeEntry() |
Unlike the PPAPI, directories do not have to be empty. |
Rename |
|
FS (partial) |
GAP (partial) - With the Native File System API, the file can be written with the new name using a combination of FileSystemFileHandle.getFile() for the new name and FileSystemFileHandle.createWriter().write() with the contents of the old file. Then FileSystemDirectoryHandle.removeEntry() to delete the old file. |
There is not a direct API that will do this in one step in the Native File System API. |
Query |
|
GAP (partial) |
Blob.size, FileSystemHandle.getFile(), FileSystemHandle.getDirectory(), File.lastModified |
GAP (partial) - Blob.type can also be used to check the MIME type. The file system type, creation time, and last access time can not be determined with the Native File System API. |
ReadDirectoryEntries |
|
FS (partial) |
FileSystemDirectoryHandle.getEntries() |
|
PPAPI Method |
Assumes Threads |
Emscripten |
Web API |
Limitations |
Create |
|
SDL |
Canvas.getContext('2d') |
|
Describe |
|
SDL |
Canvas.clientWidth + Canvas.clientHeight |
|
PaintImageData |
|
SDL |
CanvasRenderingContext2D.putImageData |
|
Scroll |
|
GAP |
CanvasRenderingContext2D.scrollIntoView, CanvasRenderingContext2D.drawImage |
GAP (partial) - Can be implemented by drawing the canvas onto itself, with an offset, using drawImage, and then filling in the rest. |
ReplaceContents |
|
SDL |
CanvasRenderingContext2D.drawImage |
|
Flush |
|
GAP |
No direct equivalent |
GAP (partial) -
There is always an implicit flush at the end of draw code; this is unlikely
to change. However, the combination of
OffscreenCanvas
and
ImageBitmapRenderingContext
provide similar functionality. |
SetScale |
|
SDL |
CanvasRenderingContext2D.scale |
|
GetScale |
|
SDL |
CanvasRenderingContext2D.currentTransform |
|
SetLayerTransform |
|
SDL |
CanvasRenderingContext2D.setTransform
CanvasRenderingContext2D.scale
CanvasRenderingContext2D.translate |
|
PPAPI Method |
Assumes Threads |
Emscripten |
Web API |
Limitations |
BindGraphics |
|
SDL |
Canvas.getContext (moot as binding is automatic). |
|
IsFullFrame |
|
GAP |
GAP - No equivalent to mime type handlers. |
NaCl apps can be registered to handle a particular mime type and own the whole document. |
DidCreate |
|
N/A |
<Element>[key] |
General DOM access lets you fish out tag attributes |
DidDestroy |
|
N/A |
N/A |
Not triggered for NaCl |
DidChangeView |
|
N/A |
Element 'resize' Event |
|
DidChangeFocus |
|
N/A |
Element 'focus', 'focusin', 'focusout' Events |
|
HandleDocumentLoad |
|
N/A |
GAP - No way to register as a mime type handler |
NaCl modules via apps + a manifest entry can be set up to handle particular mime types. |
PPAPI Method |
Assumes Threads |
Emscripten |
Web API |
Limitations |
Create |
|
GAP |
Canvas Capture |
Canvas Capture provides the ability to introduce video frames programatically. |
Configure |
|
GAP |
applyConstraints(), getUserMedia() |
GAP (partial) - The extent of configurations available in the Web API may differ from the PPAPI. |
GetAttrib |
|
GAP |
MediaStreamSettings.width |
|
|
|
GAP |
MediaStreamSettings.height |
|
|
|
GAP |
GAP - no equivalent to PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES |
MediaStream cannot be preloaded, so it will never buffer: https://www.w3.org/TR/mediacapture-streams/#mediastreams-in-media-elements |
|
|
GAP |
GAP - no equivalent to PP_MEDIASTREAMVIDEOTRACK_ATTRIB_FORMAT |
|
GetId |
|
GAP |
MediaStreamTrack.id |
|
HasEnded |
|
GAP |
MediaStreamTrack.readyState |
|
GetFrame |
|
GAP |
GAP - No equivalent |
|
RecycleFrame |
|
GAP |
GAP - No equivalent |
|
Close |
|
GAP |
MediaStreamTrack.stop() |
|
GetEmptyFrame |
|
GAP |
GAP - No equivalent |
|
PutFrame |
|
GAP |
GAP - No equivalent |
|
PPAPI Method |
Assumes Threads |
Emscripten |
Web API |
Limitations |
Create |
|
N/A |
Mostly moot, workers get an implicit event loop. |
|
GetForMainThread |
|
N/A |
Mostly moot, workers get an implicit event loop. |
|
GetCurrent |
|
N/A |
Mostly moot, workers get an implicit event loop. |
|
AttachToCurrentThread |
|
N/A |
Mostly moot, workers get an implicit event loop. |
|
Run |
|
N/A |
Mostly moot, workers get an implicit event loop. |
|
PostWork |
|
N/A |
Mostly moot, workers get an implicit event loop. |
|
PostQuit |
|
N/A |
Mostly moot, workers get an implicit event loop. |
|
PPAPI Method |
Assumes Threads |
Emscripten |
Web API |
Limitations |
SetTextInputType |
|
GAP |
GAP - Potentially filled by Input Method Editor API |
Some developers would like to either be able to hint in this fashion, or preferrably the ability to intercept and display IME events / output inline inside a canvas. |
UpdateCaretPosition |
|
GAP |
GAP - Potentially filled by Input Method Editor API |
https://www.w3.org/TR/ime-api/ |
CancelCompositionText |
|
GAP |
GAP - Potentially filled by Input Method Editor API |
https://www.w3.org/TR/ime-api/ |
UpdateSurroundingText |
|
GAP |
GAP - Potentially filled by Input Method Editor API |
https://www.w3.org/TR/ime-api/ |
PPAPI Method |
Assumes Threads |
Emscripten |
Web API |
Limitations |
Create |
|
embind |
new XMLHttpRequest(); |
|
Open |
|
embind |
XMLHttpRequest.open |
|
FollowRedirect |
|
embind |
Request.redirect |
|
|
|
GAP |
GAP - No XMLHTTPRequest equivalent |
|
GetUploadProgress |
|
embind |
XMLHttpRequest 'progress' Event |
|
|
|
GAP |
FetchObserver |
Not specced or implemented yet; https://github.com/whatwg/fetch/issues/607 |
GetDownloadProgress |
|
embind |
XMLHttpRequest 'progress' Event |
|
|
|
GAP |
FetchObserver |
Not specced or implemented yet; https://github.com/whatwg/fetch/issues/607 |
GetResponseInfo |
|
embind |
XMLHttpRequest.getAllResponseHeaders |
|
|
|
embind |
Fetch Response.* |
|
ReadResponseBody |
|
embind |
XMLHttpRequest.response |
|
|
|
embind |
Body.* (Response is a Body) |
|
FinishStreamingToFile |
|
embind |
GAP - No direct equivalent |
XMLHttpRequest and Fetch both assume streaming to memory, rather than directly to a storage. |
Close |
|
embind |
XMLHttpRequest.abort |
|
|
|
GAP |
Fetch API: AbortSignal and AbortController |
|
PPAPI Method |
Assumes Threads |
Emscripten |
Web API |
Limitations |
Create |
|
GAP |
GAP - Would be handled with the proposed WebCodecs API using VideoDecoder() |
https://github.com/WICG/web-codecs/blob/master/explainer.md#example-of-decode-for-low-latency-live-streaming-or-cloud-gaming |
Initialize |
|
GAP |
GAP - Would be handled with the proposed WebCodecs API using VideoDecoder() initialization parameters (VideoDecoderInitParameters) |
https://github.com/WICG/web-codecs/blob/master/explainer.md#example-of-decode-for-low-latency-live-streaming-or-cloud-gaming |
Decode |
|
GAP |
GAP - Would be handled with the proposed WebCodecs API using ReadableStream.pipeThrough(VideoDecoder) |
https://github.com/WICG/web-codecs/blob/master/explainer.md#example-of-decode-for-low-latency-live-streaming-or-cloud-gaming |
GetPicture |
|
GAP |
GAP - Would be handled with the proposed WebCodecs API using ReadableStream.pipeThrough(VideoDecoder).pipeTo(VideoTrackWriter().writable) |
https://github.com/WICG/web-codecs/blob/master/explainer.md#example-of-decode-for-low-latency-live-streaming-or-cloud-gaming |
RecyclePicture |
|
GAP |
GAP - Would be handled with the proposed WebCodecs API. The current design will automatically recycle the pictures and keep the decoding process going. |
https://github.com/WICG/web-codecs/blob/master/explainer.md#example-of-decode-for-low-latency-live-streaming-or-cloud-gaming |
Flush |
|
GAP |
GAP - Would be handled with the proposed WebCodecs API. The API will be called Flush(), however there is still discussion on how it will be sequenced in relation to decode calls. |
https://github.com/WICG/web-codecs/blob/master/explainer.md#example-of-decode-for-low-latency-live-streaming-or-cloud-gaming |
Reset |
|
GAP |
GAP - Would be handled with the proposed WebCodecs API by destroying the VideoDecoder instance and creating a new one. This won't be as efficient as a dedicated reset method, but the semantics for a Reset() API is still being discussed. |
https://github.com/WICG/web-codecs/blob/master/explainer.md#example-of-decode-for-low-latency-live-streaming-or-cloud-gaming |
PPAPI Method |
Assumes Threads |
Emscripten |
Web API |
Limitations |
Create |
|
GAP |
GAP - Would be handled with the proposed WebCodecs API using VideoEncoder() |
|
GetSupportedProfiles |
|
GAP |
GAP (partial) - navigator.mediaCapabilities.encodingInfo() |
The supported profiles have to be checked one by one. |
Initialize |
|
GAP |
GAP - Would be handled with the proposed WebCodecs API using VideoEncoder() initialization parameters |
|
GetFramesRequired |
|
GAP |
GAP - No equivalent |
It is unlikely that the frame pool used internally by the Web Codecs API is exposed. |
GetFrameCodedSize |
|
GAP |
GAP - No equivalent |
It is unlikely that the frame pool used internally by the Web Codecs API is exposed. |
GetVideoFrame |
|
GAP |
GAP - Would be handled with the proposed WebCodecs API by using ReadableStream.pipeThrough(VideoEncoder). This would directly encode the data in the Readable stream instead of grabbing a single frame to fill with data before encoding. |
|
Encode |
|
GAP |
GAP - Would be handled with the proposed WebCodecs API using ReadableStream.pipeThrough(VideoEncoder) |
|
GetBitstreamBuffer |
|
GAP |
GAP - Would be handled with the proposed WebCodecs API. The current design will automatically go through the encoded bitstream buffer that is piped through. |
The WebCodecs API currently assumes that bitstream buffer can be copied rather than pooled, so it will not need to be recycled. |
RecycleBitstreamBuffer |
|
GAP |
GAP - Would be handled with the proposed WebCodecs API. The current design will automatically recycle the buffer to keep the encoding process going. |
This is unlikely to change in the future as performance implications are smaller. |
RequestEncodingParametersChange |
|
GAP |
GAP - Would be handled by the proposed Web Codecs API. Certain parameters will have the capability of being changed on the fly, while others will require the encoder to be torn down. |
|
Close |
|
GAP |
GAP - Would be handled with the proposed WebCodecs API by using VideoEncoder.Close() |
|