이벤트
player와 관련된 여러 이벤트들은 콜백함수를 등록하여 이벤트를 받을 수 있다.
이벤트 목록
특정 이벤트 콜백함수 등록
on() 함수
//핸들러 함수 정의 const onPlay = function(data){ //"data"는 해당 이벤트와 관련된 프로퍼티를 포함하는 객체 };
//ended 이벤트에 onPlay 함수를 핸들러로 등록 player.on('ended', onPlay);
특정 이벤트 콜백함수 해제
off() 함수
//ended 이벤트를 리스닝하고 있는 onPlay 함수 해제 player.off('ended', onPlay); //ended 이벤트에 걸려있는 '모든' 리스너 해제 player.off('ended');