2 qq 24435837 qq_24435837 于 2017.09.14 10:48 提问

jwplayer播放器 手机端用不了啊 10C

用的是kindeditor-4.1.10编辑器,上传视频后,PC端可以显示并播放,手机端播放不了

 <embed id="player" allowscriptaccess="always" allowfullscreen="true" flashvars="file=/pic/flash/20170831/20170831130646_349.mp4" src="/kindeditor-4.1.10/plugins/jwplayer/player.swf" width="770" height="450" quality="high" />

1个回答

showbo
showbo   Ds   Rxr 2017.09.14 11:06

自己用js处理下,判断是移动端就更改为video标签

 <embed id="player" allowscriptaccess="always" allowfullscreen="true" flashvars="file=/pic/flash/20170831/20170831130646_349.mp4" src="/kindeditor-4.1.10/plugins/jwplayer/player.swf" width="770" height="450" quality="high" />
<script>
    var mobile = /AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|Aphone|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE|Android|webOS|iPhone|iPod|BlackBerry|iPad/i.test(navigator.userAgent));
    if (mobile) {
        var video = document.createElement('video'), player = document.getElementById('player');
        video.src = player.getAttribute('flashvars').replace('file=', '');
        video.style.height = player.getAttribute('height') + 'px'
        video.style.width = player.getAttribute('width') + 'px';
        console.log(video)
        player.parentNode.replaceChild(video, player);
    }
</script>
Csdn user default icon
上传中...
上传图片
插入图片