Problem/Motivation
We recently ran into this issue, when using Vidstack Player. This module uses the remote script https://cdn.vidstack.io/player, but for some reason it was still blocked even after disabling "Block unknown external resources". We also tried to create a new Vidstack "Klaro! service" using "vidstack.io", "cdn.vidstack.io" and "https://vidstack.io" as the Sources to allow, but even after cache clear and accepting all services, the cdn script was still blocked.
Steps to reproduce
- Enable Klaro and its setting "Block unknown external resources"
- Require drupal/vidstack_player, enable it and use it as a formatter on the media video type, video field.
- Disable "Block unknown external resources" and create a Klaro! service with the sources stated above.
- Flush all caches and reload the page containing a vidstack formatted video.
- Accept all klaro services (cookies) and see that the cdn script is still blocked by klaro.
Proposed resolution
The script shouldn't be blocked.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork klaro-3521502
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jan kellermann commentedYou are using "module" for type-attribute. I suspect that this can cause the problem. I have to check later.
Edit: this line https://git.drupalcode.org/project/klaro/-/blob/3.x/klaro.module?ref_typ...
Comment #3
jan kellermann commentedComment #5
jan kellermann commentedI added the handling for given type.
Can you please test, review and feedback?
Thank you!
Comment #6
grevil commentedThank you, @jan kellermann! I'll test it later this day! :)
Comment #7
anybodyNice finding @jan kellermann that looks promising and totally makes sense! Thank you for the super quick reply!
Comment #8
grevil commentedOk, the script is present now! Unfortunately at the time, that the vidstack player gets initiated, klaro hasn't finished processing the script yet, and therefore we still have the same warning in the console output:
So if klaro is present, we somehow need to wait for klaro until we can fire our script. I tried to add klaro/klaro as a dependency to our script, but it doesn't seem to fix the problem...
@anybody, any idea? Should we continue with this problem in the vidstack_player module?
Comment #9
anybodyNo idea yet, sorry. Sounds like some kind of race condition / timing issue...
Comment #10
jan kellermann commentedI have the same problem without klaro but bigpipe enabled.
Maybe change your loading pattern like this?
https://git.drupalcode.org/project/klaro/-/merge_requests/58.diff
See https://git.drupalcode.org/issue/vidstack_player-3519538/-/compare/1.x.....
Comment #11
jan kellermann commentedComment #12
jan kellermann commented@sascha_meissner: I replaced
application/javascriptwithtext/javascript. Can you please test again?@anybody / @grevil: Did you check my suggestions to avoid race conditions in vidstack_player? Maybe you can review this issue also?
Comment #13
sascha_meissnerReviewed and tested, Looking great for me :)
Comment #14
jan kellermann commentedThe fix is merged.
Thank you all for fixing this issue.