2016-08-11 4 views
1

그래서 (uppah.net)HTML5 비디오는 크롬에서 재생되지 않습니다

나는 단지에서 비디오를 재생하기 위해 노력하고있어 난 그냥 재미를 위해 사용하는 웹 사이트를 가지고,하지만 난 현재 웹 사이트에 문제가 이 웹 사이트는 Chrome에 표시되지 않습니다. 그것은 Microsoft Edge와 Internet Explorer에서 잘 작동합니다.

Google 크롬이 MP4를 지원하지 않는다는 것을 읽었으므로 동영상 형식을 WebM으로 변경하려고했지만 동일한 결과가 나타났습니다.

나는 다음과 같은 코드를 사용하고 있습니다 :

<html> 
    <head> 
     <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> 
     <title>Uppah</title> 
     <link href="style.css" rel="stylesheet" /> 
     <link href="FCNTiGM.gif" rel="shortcut icon" /> 

     <script> 
      function load() { 
       document.getElementById("vsrc").src = Math.floor((Math.random()*11)+1)+".mp4"; 
      } 
     </script> 

    </head> 
    <body onload="load()"> 
     <div id="wrapper"> 
      <video autoplay class="video" loop><source id="vsrc" /> Please update your browser.</video> 
     </div> 


     <div id="polina"> 
      <h1>Uppah</h1> 

      <p><a href="http://steamcommunity.com/id/Uppahmost" target="_blank">Steam Profile</a></p> 
      &nbsp; 

      <p>You won&#39;t find any hacks here, noob. :^)&nbsp;</p> 
     </div> 
    </body> 
</html> 

나는 변경 시도했다 :

<script> 
    function load() { 
     document.getElementById("vsrc").src = Math.floor((Math.random()*11)+1)+".mp4"; 
    } 
</script> 

<script> 
    function load() { 
     document.getElementById("vsrc").src = Math.floor((Math.random()*11)+1)+".webm"; 
    } 
</script> 

속으로 그러나이 재생되지 않습니다.

답변

1

function load() { 
 
    var src = Math.floor((Math.random()*11)+1)+".mp4"; 
 
    var wrapper = document.getElementById("wrapper"); 
 
    wrapper.innerHTML = '<video autoplay class="video" id="video" loop><source src="'+src+'" type="video/mp4" /> Please update your browser.</video>'; 
 
}
<html> 
 
    <head> 
 
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> 
 
    <title>Uppah</title> 
 
    <link href="style.css" rel="stylesheet" /> 
 
    <link href="FCNTiGM.gif" rel="shortcut icon" /> 
 

 
    </head> 
 
    <body onload="load()"> 
 
    <div id="wrapper"> 
 

 
    </div> 
 
    <div id="polina"> 
 
     <h1>Uppah</h1> 
 

 
     <p><a href="http://steamcommunity.com/id/Uppahmost" target="_blank">Steam Profile</a></p> 
 
     &nbsp; 
 

 
     <p>You won&#39;t find any hacks here, noob. :^)&nbsp;</p> 
 
    </div> 
 
    </body> 
 
</html>
여기

같은 전체 비디오 요소 (단지 히트 출력 버튼 "JS와 함께 실행"작업 예이다 div에 랩퍼에 추가하지 않는 이유는

섹션) : http://jsbin.com/kabibifoqo/edit?html,js,output

+1

완벽하게 실행됩니다! 고마워요! – Uppah

관련 문제