使用require js 模塊化代碼時,其中播放器用的是jwplayer7.x 然後載入jwplayer.js後總是報license無效(license已經加入),最後在jwplayer官網論壇里找到問題: The reason seems to be that the flash player n ...
使用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;
...
})