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
fix: video/audio playing on custom stream protocols #22955
fix: video/audio playing on custom stream protocols #22955
Conversation
&GetSchemeRegistryWithoutLocking()->standard_schemes); | ||
} | ||
|
||
+void AddStreamingScheme(const char* new_scheme) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argument SchemeType
is not defined here, hence undefined symbols with overloaded functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, I'll give that a fix.
@@ -173,6 +178,11 @@ ProtocolError Protocol::RegisterProtocol(ProtocolType type, | |||
const std::string& scheme, | |||
const ProtocolHandler& handler) { | |||
bool added = protocol_registry_->RegisterProtocol(type, scheme, handler); | |||
if (added) { | |||
if (type == ProtocolType::kHttp || type == ProtocolType::kStream) { | |||
g_streaming_schemes.push_back(scheme); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Necessary review, this call assumes that registerSchemeAsPrivileged
will be called after , but we document users to make the registerSchemeAsPrivileged
as the first call in the app as early as possible before app ready due to threading constraints in //url
.
The right way would be to provide a new option stream: true
in the registerSchemeAsPrivileged
api and go from there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My assumption was that we should automatically register known-streaming protocols, but I guess you're saying that's not an option due to when registerProtocol()
is called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you're saying that's not an option due to when registerProtocol() is called?
Yup
08c49ae
to
eb40f0a
Compare
@deepak1556 The PR has been fixed and updated with your suggestions. You can find a test fiddle here (be sure to update the video path in main.js): https://gist.github.com/283332286b015993700cabf1262ff6d4 Per @nornagon's suggestion, I'm going to submit the chromium patch to chromium to see if they'll upstream it. I'll keep this PR updated with progress on that front. |
|
||
This patch adds a list of "streaming protocols" to the url SchemeRegistry in order to allow | ||
other protocols to register their streaming behavior. MultibufferDataSource::AssumeFullyBuffered() | ||
then refers to the registry so that it can correctly determine the data source's settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also provide a way to register via ContentClient::AddAdditionalSchemes
https://source.chromium.org/chromium/chromium/src/+/master:content/public/common/content_client.h;l=117-148 so that we can register the scheme in ElectronContentClient::AddAdditionalSchemes
that will help the network service process understand the scheme.
This is needed if there is a check in the network service for streaming. I am not familiar with that code, but once you upstream the patch, chromium folks will advice if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Issue opened in Chromium tracker: https://bugs.chromium.org/p/chromium/issues/detail?id=1068034#c3 |
Chromium CI created: https://chromium-review.googlesource.com/c/chromium/src/+/2161417/ |
Just to note that the notes read:
I think you mean playback. |
Ah, yes. Whoops, thanks for the correction |
Chromium just closed as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather see this accomplished without patching //url. It seems like we could get away with a more specific patch that just targets MultibufferDataSource::AssumeFullyBuffered
.
2219d69
to
9024668
Compare
@nornagon Okay! I've rewritten the PR so that the chromium patch adds the "streaming protocols" list to the media namespace (in the MultibufferDataSource code). Let me know if that's looking better to you. |
Okay looks like the builds are failing because of something related to my patch. I'll check into that. I'll also add a test and improve the docs a bit. |
f97d7f1
to
bd86687
Compare
Test and more docs are added. Also rebased onto master. Let's see how the builds go... |
A note about the test: I found that very small videos will play correctly even without the fix in this PR. The included video is the smallest I could find which still triggers the behavior (63kb) |
patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch
Outdated
Show resolved
Hide resolved
bd86687
to
654ca9d
Compare
Pushed an update as requested, questions remaining on 2 items |
654ca9d
to
c0c20ec
Compare
Pushed an update (hopefully) resolving issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor changes to the patch. Otherwise LGTM! That webm generator is pretty nifty.
patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch
Outdated
Show resolved
Hide resolved
patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch
Outdated
Show resolved
Hide resolved
c0c20ec
to
e68e3c8
Compare
Hey I hope yall don't mind the bump, just wanted to see if we can get this merged! |
@pfrazee looks like there are merge conflicts, would you mind resolving them? |
Sure thing |
69a2e97
to
8a5e184
Compare
Okay still waiting on the tests but I think the conflicts are all set |
Ugh why are the builds failing now. Testing locally. |
8a5e184
to
4120d63
Compare
Appveyor is failing with
But my build does not. Trying to diagnose... |
Okay I can't sort out why online builds are failing over this but not in my local env. I hate to punt but do yall have any pointers on why this might be happening? |
@pfrazee for linux and mac we have that failing step you see on appveyor as a separate pipeline which also fails linux-x64-testing-gn-check The check thats failing is basically https://gn.googlesource.com/gn/+/master/docs/reference.md#cmd_check which is to validate that included headers match the build dependency graph and makes sure that appropriate targets are being built. Its a pre-build sanity check. If you look at the full output, it reads
|
4120d63
to
b0234b4
Compare
@deepak1556 I guess you could say I was in the deps of despair. Appreciate the explanation. I'll look a little more closely next time -- if I had noticed which command that was failing, I might have been able to trace the meaning of the error. Just pushed again, I'll ping if we're all-clear. |
Appears one (presumably unrelated) test in windows failed due to a timeout. Otherwise all clear. |
Release Notes Persisted
|
🎉 Thanks again for all the help with this PR |
I recently ran into this issue on Friday, and what lucky timing with this PR. Now that this code is merged, will it be in the next bugfix release of 9, or will this be scheduled for a later release? |
This PR has not been targeted to be backported to any previous version, so with no further action it will be available in v11. This is a new feature, so backporting it to an old version would mean bumping the minor version and require approval from the Releases WG. See https://github.com/electron/governance/tree/master/wg-releases#feature-backport-requests for more details on the process for requesting feature backports. |
Sorry to be a pest but this didn't make it into today's 10 beta.3, what's the plan? Is it just in the backlog? |
Oh man I'm so sorry, I must have had a cached page or something because I didn't see @nornagon's reponse. I hate being a pest on merges to begin with so now I really feel bad 😅 See you in v11! |
Description of Change
Currently,
<video>
and<audio>
tags fail to play for custom streaming protocols.blink::WebMediaPlayerImpl
- which provides the<video>
and<audio>
behaviors - needs to know whether a data source will stream or fully buffer the response. It determines this behavior withMultibufferDataSource::AssumeFullyBuffered()
which has http/s hardwired. An incorrect determination will cause the video/audio to fail playing.This PR includes a chromium patch which adds a list of "streaming protocols" in order to allow other protocols to register their streaming behavior.
MultibufferDataSource::AssumeFullyBuffered()
then refers to the registry so that it can correctly determine the data source's settings.Reference issue: #21018 (comment)
Checklist
npm test
passesRelease Notes
Notes: Added {stream:} option to registerSchemeAsPrivileged to enable custom protocols to stream video and audio