Hello, I just want to ask if there’s a possible way to set autoplay false the twitch div player where in, If the youtube or fb tab is active, the twitch div player will automatically pause?
here is the code for the button and divs:
<ul class="main-menu-header">
<li role="presentation" class="active"><a href="#user-twitch" class="admin_header_active" id="twitch" aria-controls="user-twitch" role="tab" data-toggle="tab">Twitch</a></li>
<li role="presentation"><a href="#user-youtube" id="youtube" aria-controls="user-youtube" role="tab" data-toggle="tab">Youtube</a></li>
<li role="presentation"><a href="#user-facebook" id="facebook" aria-controls="" role="user-facebook" data-toggle="tab">Facebook</a></li>
</ul>
<!-- Twitch Vid Player -->
<div class="row" id="user-twitch">
<div class="col-md-12">
<div >
<input type="hidden" name='match_id' value='{{$match->id}}' />
<div id="player" style="width: 50% !important;"></div>
</div>
</div>
</div>
<!-- Youtube Vid Player -->
<div class="row" id="user-youtube">
<div class="col-md-12">
<div >
<iframe width="600" height="345" src="https://www.youtube.com/embed/{{$match->stream_yt}}?autoplay=1"></iframe>
</div>
</div>
</div>
<!-- Facebook Vid Player -->
<div class="row" id="user-facebook">
<div class="col-md-12">
<div >
<div class="fb-post" data-href="https://www.facebook.com/{{$match->stream_fb}}/" data-width="600"></div>
</div>
</div>
</div>
and here is the code for the JS:
<script>
$(document).ready(function(){
$('#twitch').click(function(){
$(this).addClass('admin_header_active');
$('#user-youtube').removeClass('admin_header_active');
$('#user-facebook').removeClass('admin_header_active');
$('#user-twitch').fadeIn();
$('#user-youtube').hide();
$('#user-facebook').hide();
});
$('#youtube').click(function(){
$(this).addClass('admin_header_active');
$('#user-twitch').removeClass('admin_header_active');
$('#user-facebook').removeClass('admin_header_active');
$('#user-twitch').hide();
$('#user-youtube').fadeIn();
$('#user-facebook').hide();
});
$('#facebook').click(function(){
$(this).addClass('admin_header_active');
$('#user-youtube').removeClass('admin_header_active');
$('#user-twitch').removeClass('admin_header_active');
$('#user-twitch').hide();
$('#user-youtube').hide();
$('#user-facebook').fadeIn();
});
})
and this is for the twitch js
<script type ="text/javascript">
var options = {
width: 600,
height: 480,
layout: “video”,
channel: ‘{{$match->stream_twitch}}’,
autoplay: false
};
var embed = new Twitch.Player(“player”, options);
changeChannel = (chan) => {
embed.setChannel(chan);
}
note: $match->stream is equals to its db column. you can ignore it