Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

rbsngarcia

Slide de Videos

Recommended Posts

pessoal, estou a procura na internet para fazer um slide de vídeo.

bom até ai tudo bem, o problema é que preciso que só avance para o próximo slide quando o vídeo do slide atual acabar.

encontrei algo nesse link:

http://clubedosgeeks.com.br/programacao/javascript/plugin-jquery-e-bootstrap-para-slide-show-com-video-youtube-e-vimeo

a idéia é a mesma, mas infelizmente é apenas para videos do youtube ou vimeo, videos salvos no servidor não funciona.

alguém pode me ajudar?

obrigado.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Para fazer o que você quer pode utilizar jQuery e o evento "ended", sempre que o evento ended é gerado passa para o proximo slider e desabilita toda a funcionalidade para passar para o proximo slide.

Pode ver o código neste link:

http://sousatg.github.io/forum/imasters/2016/08/23/duvida-slider-videos.html

Compartilhar este post


Link para o post
Compartilhar em outros sites

Para fazer o que você quer pode utilizar jQuery e o evento "ended", sempre que o evento ended é gerado passa para o proximo slider e desabilita toda a funcionalidade para passar para o proximo slide.

Pode ver o código neste link:

http://sousatg.github.io/forum/imasters/2016/08/23/duvida-slider-videos.html

OK, Vou Fazer o teste, Obrigado.

Compartilhar este post


Link para o post
Compartilhar em outros sites

deu certo. segue o codigo para quem precisar de exemplo. Obrigado sousatg.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Full Slider - Start Bootstrap Template</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/full-slider.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<![endif]-->
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Start Bootstrap</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<a href="#">About</a>
</li>
<li>
<a href="#">Services</a>
</li>
<li>
<a href="#">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- Full Page Image Background Carousel Header -->
<header id="myCarousel" class="carousel slide">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for Slides -->
<div class="carousel-inner">
<div class="item active">
<!-- Set the first background image using inline CSS below. -->
<div class="fill" style="background-image:url('http://placehold.it/1900x1080&text=Slide One');"></div>
<div class="carousel-caption">
<video width="320" height="240" autoplay>
<source src="000236.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
</div>
<div class="item">
<!-- Set the second background image using inline CSS below. -->
<div class="fill" style="background-image:url('http://placehold.it/1900x1080&text=Slide Two');"></div>
<div class="carousel-caption">
<h2>Caption 2</h2>
</div>
</div>
<div class="item">
<!-- Set the third background image using inline CSS below. -->
<div class="fill" style="background-image:url('http://placehold.it/1900x1080&text=Slide Three');"></div>
<div class="carousel-caption">
<h2>Caption 3</h2>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="icon-next"></span>
</a>
</header>
<!-- Page Content -->
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1>Full Slider by Start Bootstrap</h1>
<p>The background images for the slider are set directly in the HTML using inline CSS. The rest of the styles for this template are contained within the <code>full-slider.css</code>file.</p>
</div>
</div>
<hr>
<!-- Footer -->
<footer>
<div class="row">
<div class="col-lg-12">
<p>Copyright © Your Website 2014</p>
</div>
</div>
<!-- /.row -->
</footer>
</div>
<!-- /.container -->
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<!-- Script to Activate the Carousel -->
<script>
$("#myCarousel").carousel({
interval: 0
});
$("#myCarousel .active video").on( 'ended', function(){
$("#myCarousel").carousel('next');
});
</script>
</body>
</html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

De nada :) Depois faço o plugin para jQuery (quando tiver tempo) e coloco o link aqui.

Sousatg

Valeu pela dedicação em ajudar!!

E aproveitando um pouco da boa vontade!! rsrs, Teria alguma Opção de os videos iniciarem apenas quando for seu slide? pois quando abro a pagina todos os videos iniciam junto.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Sousatg

Valeu pela dedicação em ajudar!!

E aproveitando um pouco da boa vontade!! rsrs, Teria alguma Opção de os videos iniciarem apenas quando for seu slide? pois quando abro a pagina todos os videos iniciam junto.

Consegui resolver o problema de dar play apenas quando chegar a vez de cada video. e no final do slide ele atualiza a pagina.. segue o codigo pra quem precisar:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Full Slider - Start Bootstrap Template</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/full-slider.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<![endif]-->
</head>
<body onload="playVid()">
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Start Bootstrap</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<a href="#">About</a>
</li>
<li>
<a href="#">Services</a>
</li>
<li>
<a href="#">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- Full Page Image Background Carousel Header -->
<header id="myCarousel" class="carousel slide">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for Slides -->
<div class="carousel-inner">
<div class="item active">
<!-- Set the first background image using inline CSS below. -->
<div class="fill" style="background-image:url('http://placehold.it/1900x1080&text=Slide One');"></div>
<div class="carousel-caption">
<video id="video1" width="320" height="240" muted>
<source src="trailer/3.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
</div>
<div class="item" >
<!-- Set the second background image using inline CSS below. -->
<div class="fill" style="background-image:url('http://placehold.it/1900x1080&text=Slide Two');"></div>
<div class="carousel-caption">
<video id="video2" width="320" height="240" muted>
<source src="trailer/3.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
</div>
<div class="item">
<!-- Set the third background image using inline CSS below. -->
<div class="fill" style="background-image:url('http://placehold.it/1900x1080&text=Slide Three');"></div>
<div class="carousel-caption">
<video id="video3" width="320" height="240" muted>
<source src="trailer/3.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="icon-next"></span>
</a>
</header>
<!-- Page Content -->
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1>Full Slider by Start Bootstrap</h1>
<p>The background images for the slider are set directly in the HTML using inline CSS. The rest of the styles for this template are contained within the <code>full-slider.css</code>file.</p>
</div>
</div>
<hr>
<!-- Footer -->
<footer>
<div class="row">
<div class="col-lg-12">
<p>Copyright © Your Website 2014</p>
</div>
</div>
<!-- /.row -->
</footer>
</div>
<!-- /.container -->
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<!-- Script to Activate the Carousel -->
<script>
var variavel_gobal = 1;
var variavel_gobalFinal = 2;
function playVid() {
document.getElementById("video"+variavel_gobal).play();
document.getElementById("myVideo");
}
$("#myCarousel").carousel({
interval: 0
});
$("#myCarousel video").on( 'ended', function(){
$("#myCarousel").carousel('next');
if(variavel_gobal <=variavel_gobalFinal){
variavel_gobal++;
playVid();
}else{
window.location.reload(); //Atualiza pagina no final do slide
}
});
</script>
</body>
</html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.