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

Register HttpPlugin for file:// for use in eg. electron #1222

Closed
cromefire opened this issue Jan 11, 2018 · 10 comments
Closed

Register HttpPlugin for file:// for use in eg. electron #1222

cromefire opened this issue Jan 11, 2018 · 10 comments
Labels
status: archived Archived and locked; will not be updated status: will not implement The team chooses not to implement this enhancement

Comments

@cromefire
Copy link

cromefire commented Jan 11, 2018

Have you read the FAQ and checked for dublicates?: yes

What version of Shaka Player are you using: jscdn from about one month ago

Can you reproduce the issue with our latest release version: Unless someone implemented it, no and I don't think so, but I don't tested it.

Can you reproduce the issue with the latest code from master: same as above

Are you using the demo app or your own custom app: A custom app

If custom app, can you reproduce the issue using our demo app: I can't test it in the demo app, because I use local files (but on a web server every thing works fine)

What browser and OS are you using: Electron with node v8 on Ubuntu artful

What are the manifest and license server URIs: it is a local file generated by Shaka packager from an mp4, it has no protection

What did you do?
I loaded the locally stored manifest (electron seemed to make file:// from it)

What did you expect to happen?
Shaka loads the manifest

What actually happened?
Shaka says, it can't load the manifest (1000)

Edit

Shaka doesn't know by default how to handle file:// requests as use in for example electron. Please register it by default.

@theodab
Copy link
Contributor

theodab commented Jan 11, 2018

A 1000 error is UNSUPPORTED_SCHEME. That means that we have no network plugin registered for the "file" scheme. I think our XMLHttpRequest plugin would work for it (assuming CORS doesn't become a problem, of course).

Try running this code when launching your app:
shaka.net.NetworkingEngine.registerScheme('file', shaka.net.HttpPlugin, shaka.net.NetworkingEngine.PluginPriority.FALLBACK);
That will register the XMLHttpRequest plugin to also handle file:// requests. Hope that helps.

@theodab theodab added the type: question A question from the community label Jan 11, 2018
@cromefire
Copy link
Author

I currently have some minor issues with my application, but it seems to be working.
How about registering it by default?

@theodab theodab added type: enhancement New feature or request and removed type: question A question from the community labels Jan 12, 2018
@cromefire cromefire changed the title Can't load local (file://) manifest in electron Register HttpPlugin for file:// for use in eg. electron Jan 15, 2018
@cromefire
Copy link
Author

If anyone tells me, where the registering happens, I can do a PR.

@chrisfillmore
Copy link
Contributor

@cromefire take a look at http_plugin, at the bottom:

shaka.net.NetworkingEngine.registerScheme('http', shaka.net.HttpPlugin);
shaka.net.NetworkingEngine.registerScheme('https', shaka.net.HttpPlugin);

@theodab
Copy link
Contributor

theodab commented Jan 16, 2018

I have a CL for that change waiting on review.

@theodab
Copy link
Contributor

theodab commented Jan 16, 2018

Ok, we had a discussion about this internally, and decided to not make this an official part of Shaka Player. Browsers are our primary target, not Electron, and supporting requests to file:// would be inappropriate in a browser environment.
Instead, I will make an entry in the FAQ about this issue.

@theodab theodab added status: will not implement The team chooses not to implement this enhancement and removed type: enhancement New feature or request labels Jan 16, 2018
@joeyparrish
Copy link
Member

The short version is: you can add this at the application level with one line after loading the Shaka library:

shaka.net.NetworkingEngine.registerScheme('file', shaka.net.HttpPlugin);

We aren't doing this in the library because file: URIs are not accessible from web pages in a browser. @theodab will update the FAQ with this info.

joeyparrish pushed a commit that referenced this issue Jan 19, 2018
Closes #1222

Change-Id: I5cb9dcb07d65d839aa4809faaea9bf2273c69c68
@joeyparrish
Copy link
Member

Cherry-picked to v2.3.1.

joeyparrish pushed a commit that referenced this issue Jan 19, 2018
Closes #1222

Change-Id: I5cb9dcb07d65d839aa4809faaea9bf2273c69c68
@joeyparrish
Copy link
Member

Cherry-picked for v2.2.10.

@theodab
Copy link
Contributor

theodab commented Feb 8, 2018

Note that, when #829 is out, the solution previously presented will stop working, as the XHR-based HttpPlugin now has a new name. At that point, you will want to instead use:

shaka.net.NetworkingEngine.registerScheme('file', shaka.net.HttpXHRPlugin);

#829 will also change the FAQ entry to match.

@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated status: will not implement The team chooses not to implement this enhancement
Projects
None yet
Development

No branches or pull requests

5 participants