花生喂龙 2017-09-14 02:48 采纳率: 100%
浏览 2520
已结题

jwplayer播放器 手机端用不了啊

用的是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条回答 默认 最新

  • 斯洛文尼亚旅游 2017-09-14 03: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>
    
    评论

报告相同问题?