2012-12-21 2 views
0

이미지 또는 비디오를 html로 표시하는 방법을 알아 내려고하고 있습니다. 명확히하기 위해 비디오를 표시하고 싶지만 비디오가 없거나 파일을 찾을 수없는 경우 대신 기본 그림을 표시하고 싶습니다. 기본적으로 비디오가 표시되지 않거나 표시되지 않을 경우 표시 할 이미지 파일입니다. 이것은 가능한가? 나는 이것을 잠시 동안 알아 내려고 노력해 왔습니다. 불운. 어떤 도움을 주시면 감사하겠습니다.이미지 또는 비디오 선택하기

답변

0

HTML5 비디오 폴백을 플래시로 제공하고 Flash를 간단한 이미지로 폴백 (fallback)하여 자바 스크립트가 전혀 필요없는이 코드를 확인하십시오.

<!-- first try HTML5 playback: if serving as XML, expand `controls` to `controls="controls"` and autoplay likewise --> 
<!-- warning: playback does not work on iOS3 if you include the poster attribute! fixed in iOS4.0 --> 
<video width="100%" height="200px" controls> 

    <!-- MP4 must be first for iPad! --> 
    <source src="__VIDEO__.MP4" type="video/mp4" /><!-- Safari/iOS video --> 
    <source src="__VIDEO__.OGV" type="video/ogg" /><!-- Firefox/Opera/Chrome10 --> 

    <!-- fallback to Flash: --> 
    <object width="640" height="360" type="application/x-shockwave-flash" data="__FLASH__.SWF"> 

     <!-- Firefox uses the `data` attribute above, IE/Safari uses the param below --> 
     <param name="movie" value="__FLASH__.SWF" /> 
     <param name="flashvars" value="controlbar=over&amp;image=__POSTER__.JPG&amp;file=__VIDEO__.MP4" /> 

     <!-- fallback image. note the title field below, put the title of the video there --> 
     <img src="__VIDEO__.JPG" width="640" height="360" alt="__TITLE__" 
     title="No video playback capabilities, please download the video below" /> 
    </object> 
</video> 

<!-- you *must* offer a download link as they may be able to play the file locally. customise this bit all you want --> 
<p>  
    <strong>Download Video:</strong> 
    Closed Format: <a href="__VIDEO__.MP4">"MP4"</a> 
    Open Format: <a href="__VIDEO__.OGV">"Ogg"</a> 
</p>​ 
관련 문제