视频出现在模拟器中但不在移动设备上

时间:2017-10-13 03:35:16

标签: html5 video mobile media responsive

以下是我的代码。视频正在Chrome中的移动模拟器上正确显示,但不会出现在移动设备上。我从视频中删除了'autoplay'并为视频创建了mp4和webm文件类型。仍然没有运气。救命?

<script>
            (function($) {
                var screenWidth = $(window).width();
                if(screenWidth < 1025 && screenWidth > 374   ){


                    customVideo = document.createElement("video");
                    customVideo.setAttribute("id", "mobileVideo");
                    customVideo.controls = true;
                    customVideo.autoplay = false;
                    customVideo.mute = true;
                    customVideo.src = 'https://kauaihp.com/wp-content/themes/KauaiHp/assets/media/KauaiHP_homepage-video_10-11-2017_v4.mp4';
                    customVideo.type = 'video/mp4';
                    customVideo.src = 'https://kauaihp.com/wp-content/themes/KauaiHp/assets/media/KauaiHP_homepage_video_10_09_2017_mp4.webm';
                    customVideo.type = 'video/webm;'

                    console.log('customVideo', customVideo);

                    $('#sliders-container').append(customVideo);
                }
            }) (jQuery);


        </script>

0 个答案:

没有答案