seonn35 2019. 2. 28. 10:46
<video id="video" loop playsinline autoplay muted>
	<source src="video.mp4">
	<source src="video.mp4" type="video/mp4">
</video>

- playsinline : 

iOS에서 동영상이 내장플레이어로 실행되는것을 막아준다(브라우저 내부에서 실행)

- autoplay : 

자동실행, mobile 환경이나 chrome 브라우저에서는 음성이 없을 때(muted) 자동실행된다. 

그 외에는 사용자 입력(버튼클릭) 시 실행 가능


iOS 비디오 정책 : https://webkit.org/blog/6784/new-video-policies-for-ios/

Chrome 비디오 자동재생 정책 : https://developers.google.com/web/updates/2017/09/autoplay-policy-changes



1. Video Play

document.getElementById(video).play();


2. Video Pause

document.getElementById(video).pause();


3. Video Volume control

document.getElementById(video).volume = 0;


4. Video ended

$("video").bind("ended", function(){
	console.log("end");
});


See the Pen video ended by seonn (@seonn) on CodePen.