Anythingslider html 5 video autoplay - html5-video

please i need your help folks!
I'm using Anythingslider to slide between HTML5 video and other content, but when I add autoplay attribute in video tag, Anythingslider plays just audio.

Are you sure the video is not hidden behind another element? Play with the z-index as the video should be visible. I've had a few issues with this in the past, such as the video flickering in and out of visibility on scroll.
I ended up playing the videos in a light box since anything slider would leave the video playing as the carousel continued to scroll. Also, if you use an infinite scroller there were also issues with it playing the video in two places.
Providing you are using something like JW Player you will be able to set up some actions to pause the video on slide or similar but basic youtube embeds will be an issue.

Don't add the autoplay attribute to HTML5 video. What is probably happening is that the cloned copy of the video (first and last slides only) is playing the video, but all you hear is the audio since the panel is not in view. The reason you don't want to autoplay is because it will still autoplay even if AnythingSlider starts with another slide visible, and it won't stop until you cycle through the panels.
If you want the video to autoplay when the panel is visible, you'll have to add some script into the completed callback (video extension is not required with the code below; demo):
var playvid = function(slider) {
var vid = slider.$currentPage.find('video');
if (vid.length) {
// autoplay
vid[0].play();
}
};
$('#slider').anythingSlider({
// Autoplay video in initial panel, if one exists
onInitialized: function(e, slider) {
playvid(slider);
},
// pause video when out of view
onSlideInit: function(e, slider) {
var vid = slider.$lastPage.find('video');
if (vid.length && typeof(vid[0].pause) !== 'undefined') {
vid[0].pause();
}
},
// play video
onSlideComplete: function(slider) {
playvid(slider);
},
// pause slideshow if video is playing
isVideoPlaying: function(slider) {
var vid = slider.$currentPage.find('video');
return (vid.length && typeof(vid[0].pause) !== 'undefined' && !vid[0].paused && !vid[0].ended);
}
});​

Related

BXSlider event when video starts playing

I am using BXSlider to display various videos. I am trying to fade out an overlay when the first video starts playing.
I have tried hooking into onSliderLoad but that trigger before the video has started playing.
Anyone know if there is a way I can detect when the video has actually started playing?
Listen for the playing event.
Demo
var vid = document.getElementById('vid');
vid.addEventListener('playing', function(e) {
console.log('Video has started');
});
<video id='vid' src='http://media6000.dropshots.com/photos/1381926/20170326/005611.mp4' width='320' height='180' controls autoplay></video>

html5 video // autoplay

I am showing a div width Text over the poster image while the video is loading and when the video is paused.
How can I detect the moment the video is fully loaded and autoplay starts? Because then, the div should be hidden.
It you have defined autoplay then detect using the play event:
video.onplay = function() { /* remove overlay here */ };
alternatively use canplay or canplaythrough when you want to manually trigger play.

Video JS - Change Play Icon in ControlBar with Replay Icon After Video End

I have a videojs player. I want to chage play icon in controlbar with replay icon when the video has end.
You can see like youtube player :
This is my code :
<script>
videojs("my_video_1").ready(function(){
var vid = this;
vid.on("ended", function(){
alert ("I want to change play icon in cotrolbar with replay icon");
// i dont know to chage play icon when the video is finish
});
});
This is my full code. You can run it via jsbin: http://jsbin.com/fijefi/2/
thank you
You don't even need javascript to do this. You can change the play icon via CSS.
In the default LESS file there are two states for the play button:
.vjs-default-skin .vjs-play-control:before {
content: #play-icon;
}
.vjs-default-skin.vjs-playing .vjs-play-control:before {
content: #pause-icon;
}
You just need to add a third state when the video has ended. There is already a CSS class for that. You'll end up with something that looks like:
.vjs-default-skin.vjs-ended .vjs-play-control:before {
content: "YOUR REPLY ICON";
}

Video.js not playing only audio with black screen

I have initialized video js player on my webpage
and i have a function that is triggered on a button click to load source to the video . and show the player and start playing it (auto start is set to true)
function playVid(x) {
videojs("vidPlay").src({type: "video/mp4", src: "http://www.domain.com/getVid?id=" + x});
showPlayer();
}
this works very well in firefox but in other browsers it only plays the audio with black video...
what is wrong here ?
how can i fix this ?

YouTube API volume toggle

Would like to know if it's possible (and how) using the YouTube iframe API to have an html button or link, external to the player, to toggle the sound on and off.
Thanks,
Mauro
see jQuery Youtube Plugin for complete specs and download.
It will be possible to declare a player like this:
jQuery("#youtube-player-container").tubeplayer({
width: 600, // the width of the player
height: 450, // the height of the player
allowFullScreen: "true", // true by default, allow user to go full screen
initialVideo: "DkoeNLuMbcI", // the video that is loaded into the player
preferredQuality: "default",// preferred quality: default, small, medium, large, hd720
onPlay: function(id){}, // after the play method is called
onPause: function(){}, // after the pause method is called
onStop: function(){}, // after the player is stopped
onSeek: function(time){}, // after the video has been seeked to a defined point
onMute: function(){}, // after the player is muted
onUnMute: function(){} // after the player is unmuted
});
Then just add a link with the desired function:
<a href="#" onClick='jQuery("#youtube-player-container").tubeplayer("mute")'>
Mute player