본문으로 건너뛰기

이벤트 처리하기

Video Editor SDK가 정상적으로 초기화 되면, 이벤트 리스너를 통해 에디터에서 발생하는 이벤트를 처리할 수 있습니다.

load

에디터가 정상적으로 초기화되었을 때 호출됩니다.

editor.on('load', () => {
console.log('The Shakr Editor is successfully loaded!');
// Your custom logic here...
});

confirm_close

에디터에 저장되지 않은 데이터가 존재할 때 에디터를 닫으면 호출됩니다. 예를 들어 여러분의 애플리케이션에서 저장되지 않는 다는 걸 확인할 수 있는 창을 띄워 확인을 받은 후, .close() 함수로 에디터를 닫는 등의 행동을 할 때 사용할 수 있습니다.

editor.on('confirm_close', () => {
if (window.confirm('Are you sure you wish to close the editor? Any unsaved changes that may exist will be lost.')){
editor.close(true);
}
});

finish

비디오를 성공적으로 만들었을 때, 비디오의 다운로드 URL을 얻을 수 있습니다. Editor SDK의 wait_rendering 옵션을 활성화했을 때만 호출됩니다.

editor.on('finish', ({ video_download_url }) => {
// User finished editing the render session, it'll start rendering now
console.log('User has finished editing render session ' + editor.render_session_id);
console.log('Video url: ' + video_download_url);
});

이벤트에 대한 더 많은 설명은 레퍼런스를 참고해주세요.