사용 예시
새로 고침 , 클립 URL 공유시 링크 유지 코드
소스클립 라이브러리를 사용 시 스와이프를 진행하면 자동으로 지정된 클립ID 로 query param 이 변경됩니다. 실제 개별 클립 링크를 공유하실 경우 아래와 같은 코드를 사용 하실 수 있습니다.
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
/>
<script src="https://player.sauceclip.com/static/js/SauceClipPlayerLib.js"></script>
//(스테이지 환경 사용시 stage.player.sauceclip... 로 변경하시면 됩니다.)
</head>
<body>
<div id="root"></div>
<script>
const url =new URLSearchParams(window.location.search)
const clipId =url.get('clipId')
window.addEventListener('DOMContentLoaded',()=>{
window.SauceClipPlayerLib.setInit({ partnerUniqueId: 'memberQA', clipId: clipId?clipId: '7495' ,elementId:'root' })
window.SauceClipPlayerLib.setFloatingType({ type:'basic' , size :0.3})
window.SauceClipPlayerLib.load()
})
</script>
</body>
</html>
Updated 9 days ago