I'm trying to setup jwplayer with DRM. I want to use playlist[].sources[] for this.
My code looks like this:
jwplayer.setup({
playlist: [{
sources: [
{ file: 'myfile1...' },
{ file: 'myfile2...' },
]
}]
});
But I have this error: Cannot add property default, object is not extensible.
If I remove sources and just go with a file, I have no error:
jwplayer.setup({
playlist: [{
file: 'myfile1...',
}]
});
But then, I can't setup multiple version of my file to handle DRM.
What can I do?
I finally found the issue. The code is actually somthing like this:
Making a copy resolve the bug:
jwplayer will mutate object to add a
defaultprop, so if your sources are memoized or an immutable object in some way, it will break.