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

Electron v11, r2-streamer-js HTTP server + prototype no-HTTP streamer (Session.protocol.registerStreamProtocol) #1258

Merged
merged 12 commits into from Jan 28, 2021

Conversation

danielweck
Copy link
Member

WIP :)

@danielweck
Copy link
Member Author

danielweck commented Nov 17, 2020

Everything works ... except Session.protocol.registerStreamProtocol() which fails for streaming video/audio media, ironically :(

See:
electron/electron#21018 (comment)
#990 (comment)

@danielweck
Copy link
Member Author

The Electron bug will be fixed in v11 (we are currently at v9):
electron/electron#22955 (comment)

@danielweck
Copy link
Member Author

danielweck commented Nov 17, 2020

Electron 11 registerSchemesAsPrivileged() and registerStreamProtocol():
https://unpkg.com/browse/electron@11.0.1/electron.d.ts#L6207

Protocols that use streams (http and stream protocols) should set `stream:
true`. The `<video>` and `<audio>` HTML elements expect protocols to buffer
their responses by default. The `stream` flag configures those elements to
correctly expect streaming responses.

...but not in Electron 10:
https://unpkg.com/browse/electron@10.1.5/electron.d.ts#L12931

@danielweck
Copy link
Member Author

r2-navigator-js Electron 11: https://github.com/readium/r2-navigator-js/pull/58/files

@danielweck
Copy link
Member Author

danielweck commented Nov 17, 2020

I confirm that registerStreamProtocol() "works" in Electron 11.0.1, including with stream: true in registerSchemesAsPrivileged(). However, audio seeking (and presumably, video, although I haven't had time to test this yet) fails. I am seeing the following event sequence emitted by the HTML audio element, but no requests are made to registerStreamProtocol() when seeking with a mouse click towards the end of the audio resource (i.e. where buffers haven't been fetched yet ... or for that matter, even if they have been fetched already):

  1. seeking
  2. waiting
  3. seeked
  4. canplay
  5. playing
  6. canplaythrough

@danielweck
Copy link
Member Author

danielweck commented Nov 17, 2020

When we activate the debug mode to visualize audio buffers, and here's what we see:

Seeking working (regular HTTP 1.1 byte-range partial requests):

AudioSeekOK

Seeking not working (registerStreamProtocol):

AudioSeekFAIL

@danielweck
Copy link
Member Author

The good news is that it looks like I am not alone in experiencing this new class of bugs in registerStreamProtocol():

electron/electron#21018 (comment)

...as reported by the same developer who implemented the initial fix:

electron/electron#22955

...so let's watch this space. But for now, we need to continue using an HTTP server (at least for audio/video resource, but in that case we might as well stick with the r2-streamer-js HTTP server for now, and wait until Electron is fixed to make a complete move to registerStreamProtocol()).

@danielweck danielweck changed the title WIP Work In Progress, DO NOT MERGE: removal of r2-streamer-js HTTP server, now Electron Session.protocol.registerStreamProtocol() WIP Work In Progress, DO NOT MERGE: removal of r2-streamer-js HTTP server, now Electron Session.protocol.registerStreamProtocol() + Electron v11 Nov 17, 2020
@danielweck danielweck changed the title WIP Work In Progress, DO NOT MERGE: removal of r2-streamer-js HTTP server, now Electron Session.protocol.registerStreamProtocol() + Electron v11 [WIP] Work In Progress, DO NOT MERGE: removal of r2-streamer-js HTTP server, now Electron Session.protocol.registerStreamProtocol() + Electron v11 Jan 8, 2021
@danielweck danielweck changed the title [WIP] Work In Progress, DO NOT MERGE: removal of r2-streamer-js HTTP server, now Electron Session.protocol.registerStreamProtocol() + Electron v11 [PARKED] (DO NOT MERGE) Electron v11 -- removal of r2-streamer-js HTTP server, now Electron Session.protocol.registerStreamProtocol() Jan 9, 2021
@danielweck danielweck changed the title [PARKED] (DO NOT MERGE) Electron v11 -- removal of r2-streamer-js HTTP server, now Electron Session.protocol.registerStreamProtocol() [WIP] Electron v11, r2-streamer-js HTTP server + prototype no-HTTP streamer (Session.protocol.registerStreamProtocol) Jan 28, 2021
@danielweck danielweck marked this pull request as ready for review January 28, 2021 09:50
@danielweck danielweck changed the title [WIP] Electron v11, r2-streamer-js HTTP server + prototype no-HTTP streamer (Session.protocol.registerStreamProtocol) Electron v11, r2-streamer-js HTTP server + prototype no-HTTP streamer (Session.protocol.registerStreamProtocol) Jan 28, 2021
@danielweck danielweck merged commit 1a01c03 into develop Jan 28, 2021
@danielweck danielweck deleted the feature/no-streamer branch January 28, 2021 09:53
@danielweck danielweck added this to Done in v1.6 Jan 28, 2021
@danielweck
Copy link
Member Author

In reference to the comment above: #1258 (comment)
...it looks like somewhere between Electron v11 and v13 the video/audio streaming buffering bug was fixed, so we are now able to migrate 👍

@danielweck danielweck added this to In progress in 1.7.2 via automation Aug 23, 2021
danielweck added a commit that referenced this pull request Aug 23, 2021
@danielweck danielweck moved this from In progress to Done in 1.7.2 Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
1.7.2
Done
v1.6
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

1 participant