jwplayer 를 이용하여 유튜브 동영상을 홈페이지 배경으로 적용 시키기?
<style type="text/css">
.jwrapbuttons {
max-width: 330px;
margin: 0 auto;
}
.jwbutton {
font-weight: bold;
font-size: 8px;
padding: 10px 30px;
border: 2px solid #FFFFFF;
color: #FFFFFF;
display: inline-block;
text-decoration: none;
margin: 50px 10px;
background: #FFFFFF(255, 0, 0, 0.3);
}
.videobgelement {
position: fixed !important;
z-index: -1;
top: 0;
left: 0;
}
</style>
<script src="https://content.jwplatform.com/libraries/yOuB4gP3.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jwplayer.js"></script>
<script type="text/javascript">
$(function () {
$(document.body).wrapInner('<div class="bgvideodata"/>');
$(document.body).prepend($('<div class="videobgelement"><div id="videobgelement"></div></div>'));
//set browser video height and browser height
var ww = $(window).width();
var wh = $(window).height();
jwplayer("videobgelement").setup({
autostart: 1,
controls: 0,
width: ww,
height: wh,
//skin:'jwplayer/jwplayer-skins-free/five.xml',
'shuffle': 'true',
'repeat': 'true',
playlist: [
{file: "https://www.youtube.com/watch?v=qHm9MG9xw1o", image: "http://img.youtube.com/vi/qHm9MG9xw1o/0.jpg"},
{file: "https://www.youtube.com/watch?v=pBsQVP-Olmw", image: "http://img.youtube.com/vi/pBsQVP-Olmw/0.jpg"},
],
});
//buttons part
$('.container').prepend('<div class="jwrapbuttons"><a href="#" class="jwbutton" id="jqbuttonpause">pause</a> <a href="#" class="jwbutton" id="jwbuttonmute">mute</a></a></div>');
$('#jqbuttonpause').click(function (e) {
e.preventDefault();
//$(document).attr('title', function (i,val){ return ''; + val; });
jwplayer().pause();
});
$('#jwbuttonmute').click(function (e) {
e.preventDefault();
jwplayer().setMute();
})
});
//be responsive
$(window).resize(function () {
var ww = $(this).width();
var wh = $(this).height();
$('.videobgelement>div').width(ww + 'px');
$('.videobgelement>div').height(wh + 'px');
});
</script>
<div class="container"></div>
샘플 http://honeymusic.kr
쇼핑몰이나 홍보용으로 용의 할듯 해서 올려 봅니다.
.jwrapbuttons {
max-width: 330px;
margin: 0 auto;
}
.jwbutton {
font-weight: bold;
font-size: 8px;
padding: 10px 30px;
border: 2px solid #FFFFFF;
color: #FFFFFF;
display: inline-block;
text-decoration: none;
margin: 50px 10px;
background: #FFFFFF(255, 0, 0, 0.3);
}
.videobgelement {
position: fixed !important;
z-index: -1;
top: 0;
left: 0;
}
</style>
<script src="https://content.jwplatform.com/libraries/yOuB4gP3.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jwplayer.js"></script>
<script type="text/javascript">
$(function () {
$(document.body).wrapInner('<div class="bgvideodata"/>');
$(document.body).prepend($('<div class="videobgelement"><div id="videobgelement"></div></div>'));
//set browser video height and browser height
var ww = $(window).width();
var wh = $(window).height();
jwplayer("videobgelement").setup({
autostart: 1,
controls: 0,
width: ww,
height: wh,
//skin:'jwplayer/jwplayer-skins-free/five.xml',
'shuffle': 'true',
'repeat': 'true',
playlist: [
{file: "https://www.youtube.com/watch?v=qHm9MG9xw1o", image: "http://img.youtube.com/vi/qHm9MG9xw1o/0.jpg"},
{file: "https://www.youtube.com/watch?v=pBsQVP-Olmw", image: "http://img.youtube.com/vi/pBsQVP-Olmw/0.jpg"},
],
});
//buttons part
$('.container').prepend('<div class="jwrapbuttons"><a href="#" class="jwbutton" id="jqbuttonpause">pause</a> <a href="#" class="jwbutton" id="jwbuttonmute">mute</a></a></div>');
$('#jqbuttonpause').click(function (e) {
e.preventDefault();
//$(document).attr('title', function (i,val){ return ''; + val; });
jwplayer().pause();
});
$('#jwbuttonmute').click(function (e) {
e.preventDefault();
jwplayer().setMute();
})
});
//be responsive
$(window).resize(function () {
var ww = $(this).width();
var wh = $(this).height();
$('.videobgelement>div').width(ww + 'px');
$('.videobgelement>div').height(wh + 'px');
});
</script>
<div class="container"></div>
샘플 http://honeymusic.kr
쇼핑몰이나 홍보용으로 용의 할듯 해서 올려 봅니다.
댓글 8개
8년 전
위에 링크 샘플 보시면 될듯 하네요
유튜브에 영상을 업로드 하여 홍보 할때 사용 하시면 되겠습니다...
이런거 올려도 되나....
유튜브에 영상을 업로드 하여 홍보 할때 사용 하시면 되겠습니다...
이런거 올려도 되나....
8년 전
{file: "https://www.youtube.com/watch?v=qHm9MG9xw1o", image: "http://img.youtube.com/vi/qHm9MG9xw1o/0.jpg"},
{file: "https://www.youtube.com/watch?v=pBsQVP-Olmw", image: "http://img.youtube.com/vi/pBsQVP-Olmw/0.jpg"},
추가 하시면 리스트 별로 영상이 무한데.. 나옵니다. 영 상이 끝나면 다음 영상을 보여줌
{file: "https://www.youtube.com/watch?v=pBsQVP-Olmw", image: "http://img.youtube.com/vi/pBsQVP-Olmw/0.jpg"},
추가 하시면 리스트 별로 영상이 무한데.. 나옵니다. 영 상이 끝나면 다음 영상을 보여줌
대한민국3대김수현
8년 전
좋은 팁이네요~^^ 고맙습니다
대한민국3대김수현
8년 전
오~~~ 좋네요! 감사히 스크랩+추천 합니당~~
8년 전
네에
8년 전
와, 헌이님! 멋있음요. ㅎㅎ 와아 ~~
근데요. 이것 팔아 먹어도 되나요? 흑흑
너무 가난합니다. 엉엉.
근데요. 이것 팔아 먹어도 되나요? 흑흑
너무 가난합니다. 엉엉.
8년 전
볶아 드세요
8년 전
히히 고맙습니다. 헌이님!
감사합니다!!
감사합니다!!
게시글 목록
| 번호 | 제목 |
|---|---|
| 23966 | |
| 23963 | |
| 23953 | |
| 23949 | |
| 23938 | |
| 23935 | |
| 23933 | |
| 23928 | |
| 23919 | |
| 23918 | |
| 23917 | |
| 23910 | |
| 23902 | |
| 23901 | |
| 23897 | |
| 23894 | |
| 23893 | |
| 23891 | |
| 23885 | |
| 23872 | |
| 23870 | |
| 23862 | |
| 23859 | |
| 23853 | |
| 23845 | |
| 23838 | |
| 23827 | |
| 23819 | |
| 23805 | |
| 23801 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기