Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

JS IPFS instance supplied via hls.config prevents Hls.js from kicking off its demuxing web worker #24

Open
UnKnoWn-Consortium opened this issue Jan 15, 2021 · 1 comment · May be fixed by #27

Comments

@UnKnoWn-Consortium
Copy link

By default, Hls.js delegates the demuxing work to a web worker and the Hls.js config is included in the payload sent to that web worker.

Error is thrown when JSON.stringify tries to "stringify" circular structure inside the JS IPFS instance. Hls.js then reverts to inline demuxing as a fallback solution. This is not ideal.

2021-01-14_090434

@UnKnoWn-Consortium
Copy link
Author

UnKnoWn-Consortium commented Jan 15, 2021

A viable solution is to inject the IPFS instance to the IPFS loader class via a factory function (that accepts the IPFS instance as an augment and supplies it to the loader class returned).

For instance,

function HlsjsIPFSLoaderFactory (ipfs) {
    return class HlsjsIPFSLoader {...}
}

Then to use it:

const ipfs = await Ipfs.create();
Hls.DefaultConfig.loader = IPFSLoaderFactory(ipfs);

@UnKnoWn-Consortium UnKnoWn-Consortium linked a pull request Jan 17, 2021 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant