dplayer options: 'autoplay', 'loop', 'screenshot', 'hotkey', 'mutex', 'dmunlimited' : bool options, use "yes" "y" "true" "1" "on" or just without value to enable 'preload', 'theme', 'lang', 'logo', 'url', 'pic', 'thumbnails', 'vidtype', 'suburl', 'subtype', 'subbottom', 'subcolor', 'subcolor', 'id', 'api', 'token', 'addition', 'dmuser' : string arguments 'volume', 'maximum' : number arguments container options: 'width', 'height' : string, used in container element style other: 'code' : value of this key will be append to script tag
$(document).on('pjax:start', function () { if (window.dplayers) { for (let i = 0; i < window.dplayers.length; i++) { window.dplayers[i].destroy(); } window.dplayers = []; } });
自定义
你可以根据自己博客的目录结构,
在 index.js 中: 定义变量 scriptDir(默认: “/assets/js/“ ) and styleDir(默认: “/assets/css/“);
使用 _config.yml 配置:
1 2 3 4 5 6 7 8
# on _config.yml of hexo-site hexo-tag-dplayer: js_path:/path/to/your/default/path css_path:/sth default:#default tag argument id:somedefid# equals to setting id=somedefid in all {%dplayer%} tags api:https://api.prprpr.me/dplayer/ #and other options...
关于如何设置自建的 Meting API 服务器地址,以及其他 MetingJS 配置,请参考章节自定义配置
PJAX 兼容
若在 Hexo 中使用了 PJAX,可能需要自己手动清理 APlayer 全局实例:
1 2 3 4 5 6 7 8
$(document).on('pjax:start', function () { if (window.aplayers) { for (let i = 0; i < window.aplayers.length; i++) { window.aplayers[i].destroy(); } window.aplayers = []; } });