很多時候跟著書和不系統(tǒng)的視頻學(xué)習(xí),會發(fā)現(xiàn)沒有方向,學(xué)了很多卻不知道自己能夠做出什么成績。
學(xué)習(xí)要有一個清晰的職業(yè)學(xué)習(xí)規(guī)劃,學(xué)習(xí)過程中會遇到很多問題,你可以到我們的web學(xué)習(xí)交流君羊-點擊此處,
同時準(zhǔn)備了基礎(chǔ),進階學(xué)習(xí)資料。學(xué)友都會在里面交流,分享一些學(xué)習(xí)的方法和需要注意的小細節(jié),每天也會準(zhǔn)時講一些項目實戰(zhàn)案例。
數(shù)學(xué)表達式calc()是CSS中的函數(shù),主要用于數(shù)學(xué)運算。使用calc()為頁面元素布局提供了便利和新的思路。相關(guān)視頻教程推薦:
為什么錄制的MP4視頻在本地可以播放但是使用html5的video多媒體播放標(biāo)簽不能正常播放只有一個進度條而不顯示圖像?其實就是一個視頻編碼的問題,格式雖然都是MP4但是html中只支持H.264的編碼格式,無奈只能重新轉(zhuǎn)換一下編碼了。
為了避免大家遇到同樣的問題我在這里就給大家普及一下html5關(guān)于<video>標(biāo)簽的知識吧:在使用html4協(xié)議做網(wǎng)站時我們想要在網(wǎng)頁上播放一個視頻要不使用flash去播放,要么就是嵌入式頁面來實現(xiàn),對于html5來說這兩種方法非常的不方便因為一個牛逼哄哄的<video>出現(xiàn)了,這個標(biāo)簽的功能就是讓多媒體文件可以很方便的在網(wǎng)頁中播放。
html中播放一個視頻只需要一個標(biāo)簽:
<video src="http://sp.ntaotu.com/localhost-wordpress-phpstudy.mp4"?controls="controls"?width="500"?height="300"></video>
[if !supportLists]00001.?[endif]
代碼雖然少了很多,但是功能卻很健全,這就是html5的亮點之一吧!
關(guān)于標(biāo)簽所支持的視頻格式和編碼:
[if !supportLists]·?[endif]
MP4 = MPEG 4文件使用 H264 視頻編解碼器和AAC音頻編解碼器
[if !supportLists]·?[endif]
[if !supportLists]·?[endif]
WebM = WebM 文件使用 VP8 視頻編解碼器和 Vorbis 音頻編解碼器
[if !supportLists]·?[endif]
[if !supportLists]·?[endif]
Ogg = Ogg 文件使用 Theora 視頻編解碼器和 Vorbis音頻編解碼器
[if !supportLists]·?[endif]
通過上面的信息我們會發(fā)現(xiàn)只有h264編碼的MP4視頻(MPEG-LA公司)、VP8編碼的webm格式的視頻(Google公司)和Theora編碼的ogg格式的視頻(iTouch開發(fā))可以支持html5的標(biāo)簽。
如果瀏覽器不支持video標(biāo)簽怎么辦?
比如IE瀏覽器還有老版本的瀏覽器對html5的支持不太好,當(dāng)用戶用這些瀏覽器打開我們帶有視頻的網(wǎng)頁怎么辦呢?
我們可以把代碼這樣寫:
[if !supportLists]00001.?[endif]
<video src="http://sp.ntaotu.com/localhost-wordpress-phpstudy.mp4"?controls="controls"?width="500"?height="300">您的瀏覽器不支持播放該視頻!</video>
[if !supportLists]00002.?[endif]
這樣在不支持html5的瀏覽器中就會提示“您的瀏覽器不支持播放該視頻!”啦!
關(guān)于video標(biāo)簽的擴展參數(shù)說明:
video 元素允許多個 source 元素。source 元素可以鏈接不同的視頻文件。瀏覽器將使用第一個可識別的格式,這樣我們只要多準(zhǔn)備幾個不同格式的視頻就可以了。
用法:
[if !supportLists]00001.?[endif]
<video width="500"?height="250"?controls="controls">
[if !supportLists]00002.?[endif]
[if !supportLists]00003.?[endif]
<source src="movie.ogg"?type="video/ogg">
[if !supportLists]00004.?[endif]
[if !supportLists]00005.?[endif]
<source src="movie.mp4"?type="video/mp4">
[if !supportLists]00006.?[endif]
[if !supportLists]00007.?[endif]
您的瀏覽器不支持此種視頻格式。
[if !supportLists]00008.?[endif]
[if !supportLists]00009.?[endif]
</video>
[if !supportLists]00010.?[endif]
[if !supportLists]00001.?[endif]
autoplay :出現(xiàn)該屬性意味著視頻在就緒后將自動播放,用法:autoplay="autoplay"
[if !supportLists]00002.?[endif]
[if !supportLists]00003.?[endif]
controls :出現(xiàn)該屬性意味著向用戶顯示控件,如播放按鈕等,用法:controls="controls"
[if !supportLists]00004.?[endif]
[if !supportLists]00005.?[endif]
height:設(shè)置高度 width:設(shè)置寬度
[if !supportLists]00006.?[endif]
[if !supportLists]00007.?[endif]
loop:自動重播,用法:loop="loop"
[if !supportLists]00008.?[endif]
[if !supportLists]00009.?[endif]
preload:視頻在頁面加載時進行加載并預(yù)備播放,用法:preload="auto" - 當(dāng)頁面加載后載入整個視頻;preload="meta" - 當(dāng)頁面加載后只載入元數(shù)據(jù);preload="none" - 當(dāng)頁面加載后不載入視頻。注意:若使用了autoplay,則忽略preload
[if !supportLists]00010.?[endif]
相關(guān)鏈接:
詳解html中頁面跳轉(zhuǎn)傳遞參數(shù)的問題
關(guān)于HTML5網(wǎng)頁水印SDK的實現(xiàn)代碼示例
關(guān)于書籍:需要學(xué)習(xí)資料的小伙伴們可以加群,點擊此處