유튜브 iframe 백그라운드 재생 관련 질문입니다~ 채택완료
안녕하세요.
<script>
// 2. This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var section = {
start: 0, // 반복 시작 시간(초)
end: 236 // 반복 종료 시간(초)
};
// 3. This function creates an <iframe> (and YouTube player)
// after the API code downloads.
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player(
'player', {
playerVars: {
'background': 1,
'frameborder': 0,
'autoplay': 1,
'controls': 0,
'mute': 1
},
videoId: '영상주소',
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
}
);
}
function onPlayerReady(event) {
player.seekTo(section.start);
player.playVideo();
}
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.PLAYING) {
var duration = section.end - section.start;
setTimeout(restartVideoSection, duration * 1000);
}
}
function restartVideoSection() {
player.seekTo(section.start);
}
</script>
위와같이 유튜브 재생소스를 사용중인데요,
백그라운드에서 재생이 되는데 문제는 시작할 때
왼쪽 상단에 유튜브명?(유튜버이름), 오른쪽상단에 공유버튼, 오른쪽하단에 유튜브 로고가 들어가있다가 1~2초후에 사라집니다.
아예 안뜨게 막고싶습니다만 방법이있을까요?
답변 1개
답변을 작성하려면 로그인이 필요합니다.
로그인