2017-12-29 39 views
-3

iFrame API가 아닌 youtube.com에서 YouTube 플레이어와 상호 작용하는 방법은 무엇입니까? 예 : 동영상을 검색하거나 재생/일시 중지하십시오. 내 확장 프로그램을 사용하여 프로그래밍 방식으로 비디오를 재생하는 현재 시간을 설정하려고합니다.youtube.com에서 youtube 비디오를 찾는 방법?

답변

0
//First get the video 

var myPlayer = document.getElementsByClassName('video-stream html5-main-video')[0]; 


//Now you can: 

//Play video with 
myPlayer.play() 

//Pause video with 
myPlayer.pause() 

//Go to particular time with 
myPlayer.currentTime = 40 
//will take your video to 40 seconds. 

//To get current time just use 
myPlayer.currentTime