使用require js 模块化代码时,其中播放器用的是jwplayer7.x 然后载入jwplayer.js后总是报license无效(license已经加入),最后在jwplayer官网论坛里找到问题:
The reason seems to be that the flash player needs access to window.jwplayer
. window.jwplayer
is not set when using AMD (or CommonJS), therefore the flash player doesn't work.
While waiting for a fix, a workaround is to simply set window.jwplayer
in the app's code:
define(['jwplayer'], function (jwplayer) {
window.jwplayer = jwplayer;
...
})