마우스 오버 mp4 autoplay 실행 할때.그리고 DOMException: play() failed

마우스 오버 mp4 autoplay 실행 할때.그리고 DOMException: play() failed

더시민 0 1674 0

마우스 올릴때 실행하는것은 간단하게 구현된다

 

<video>

<source src="영상주소.mp4" type="video/mp4" />

</video>

 

여기서 마우스 올릴때 실행되는 부분은

 

<video  onmouseover="this.play()" onmouseout="this.pause();"  > 로 구현해주면되는데

 

먼가 클릭을 하거나 한 뒤에서부터 실행된다 

콘솔창 보면은 에러메세지가 나오는데

Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first.

 

복잡한 것들 코드 등등 많이 있는데 무척 간단한 규칙이었다

<video  onmouseover="this.play()" onmouseout="this.pause();"  mute="muted">

 

비디오 태그에 그냥 소리 안나오게 해버리면 이상없이 작동된다.

 

0 Comments
제목
Category
Facebook Twitter GooglePlus KakaoStory KakaoTalk NaverBand