-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Add custom loaders structure #307
Conversation
replace Class with instance
Very glad to receive this pull request from you. The custom loader should be passed with a class (aka. Constructor), because in VOD mode:
Rename the field name in Config |
OK. I replaced a instance of custom loader with a constructor. So, it's usage was changed like this;
|
If extra parameters are needed for custom loader's constructor, I think using closure to wrap the constructor may solve it. But why |
hmm... I don't know how to wrap constructor using closure. |
function init() {
let extraParam = null;
function createObservableLoader(seekHandler, config) {
return new ObservableLoader(extraParam, seekHandler, config);
}
flvjs.createPlayer({
type: 'flv',
isLive: true
}, {
customLoader: createObservableLoader
});
} このようにできるかも |
I see. Certainly, It seems to be possible. |
https://github.com/Bilibili/flv.js/pull/307/files#diff-e7b9ff559443937e9bb0f0932a5d11dbR232 |
(but I don't use |
I think it is accessible through the namespace FlvJs... aka |
hmm.. It can this way;
but, This is need import like this. I think this is a little ugly.
|
Merged, thanks! I will manually remove the exported type until found other solutions to refactor the d.ts. |
WHY USE CHINESE IN SUCH A PURE ENGLISH PULL REQUEST? |
a new learner... ok, I'll explain it in English. |
ref: #294
Usage:
Create your own loader (example)
Create player;