mp4/webm
This commit is contained in:
parent
81f50b743b
commit
b2fdabeb59
3 changed files with 37 additions and 4 deletions
|
|
@ -1,7 +1,23 @@
|
|||
function setVideoSrc(video, src) {
|
||||
var ext
|
||||
if (!videoExtension) {
|
||||
[
|
||||
['video/mp4; codecs="avc1.42E01E, mp4a.40.2"', '.mp4'],
|
||||
['video/webm; codecs="vp8, vorbis"', '.webm'],
|
||||
].forEach(opt => {
|
||||
if (videoExtension) { return }
|
||||
if (video.canPlayType(opt[0]).replace('no', '')) {
|
||||
videoExtension = opt[1]
|
||||
}
|
||||
})
|
||||
}
|
||||
video.src = src.replace('.webm', videoExtension)
|
||||
}
|
||||
|
||||
document.querySelector('a#play-fullscreen').addEventListener('click', event => {
|
||||
var video = document.createElement('video')
|
||||
video.classList.add('player')
|
||||
video.src = 'https://pad.ma/' + film.id + '/480p.webm'
|
||||
setVideoSrc(video, 'https://pad.ma/' + film.id + '/480p.webm')
|
||||
video.controls = true
|
||||
document.querySelector('main').appendChild(video)
|
||||
video.style.display = 'none'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue