I am making a website for a friend of mine and he wants a really complicated one. Between the menupoints there are videos and the content is displayed on the last frame. So I thought I could use the videos (about 2 seconds long) as a background and fade the content in after two seconds. How should I go about this?
what I'd do is have the content as a hidden div. When you play the video attach an onended event to it and use that to hide the video element and reveal the content - that way they always stay in sync - for instance see something like this Add a div to replace Video after Video Plays Through
Related
I'm creating a video player with HTML5 and Javascript and I'm wondering if anyone has solved the challenge of creating dynamic thumbnails.
Mimicking youtube video player where you hover over progress bar and a popup shows with a thumbnail. I know that youtube saves out an image and repositions the sprite in the thumbnail viewer frame based on position hovered over.
Is this viable to do with JS and canvas?
What I'm doing now is... hovering over my progress bar creates a copy of the video element. I then set the currentTime on the copied element. I then grab a snapshot using canvas. I'm not sure why, but the images seem to be blank.
Maybe someone has run into this problem?
YouTube have pre rendered thumbs that are stored in a single image in a grid with ten columns and how ever many rows are needed. The thum images I have seen are low quality jpg 800 pixels across giving thumbs 80 pixels by ?? (depending on aspect) When the user hovers the thumb closest to the that time is displayed.
Creating the thumbs at the client side will be problematic because video are not entirely random access. Seeking to a random location involves the video moving to the nearest previous keyframe and then decoding all frames till it gets to the frame you have requested. Depending on the format, encoding options, the spacing of key frames (if any rolling eyes), and if the seek location has been loaded, seeking to some location can be very slow. Getting a set of thumbs for a video can take a long time. The additional problem with the HTML5 video API is that it has only one playback channel, so while you are seeking for thumbs you can not watch the video.
You problem with blanks may be due to not waiting for the seek event.
Try
video.addEventListener("seeked",function(e){
// snap shot code here
});
But this does not always work I have found. So it pays to listen to all the appropriate events, and only seek when the video is ready. Here is a list of media events that will help.
As videos don't change your best bet is to create the thumbs on your server after the video has been uploaded. Low quality jpgs seem to be the go and will be loaded by the client much sooner than even a fraction of the video has been.
However, this can be achieved by using a combination of HTML5 canvas. You will have to do the following.
add an timeupdate event listener to the HTML5 video
at each 1 sec, grab the current time and create an element (span is this case) and bind the value of the current time in a special attribute of the newly created span
Append each created span element to your HTML5 progress element (I suppose you're using 'div' and not 'progress' element.
Add an mouseenter event listener to the created span.
Whenever the user hovers the progress bar, the mouse would eventually touches one of the span. Then, dynamically create a video element and set the src attribute with the main HTML5 video source. Then, set the currentTime to the value of the hovered span and snapshot it to an already canvas element.
There, you show the user the current frameRate.
Scripting is all about manipulations and gradually processes of putting pieces of codes to work.
I was wondering if anyone could help me with HTML5 video with image overlays that are timed. I want the images to display and disappear at certain times, which will make the video pause and resume on the click of a button. I want to know the best approach to this in regards using HTML5, javascript etc.
I am using the video tag in HTML5 with Dreamweaver CS6 at the moment and I have full screen video working, with an image overlaid using the z-index, but I can't get it to display and disappear at a certain time.
Any ideas?
probably you have to add some event listener to your video:
timeupdate , loadstart, ect to manage the visibility of your image in overlay
Can anyone help me with some javascript here as I got no knowledge, but I have this idea...
This is what I have on my mind:
-I want an image to be over the youtube video. (image inside of css, so no img src please)
-On click of the image (image fades out) and video loads up and start playing.
-Once video is done (I don't care if I have to add values of time when video will end manually) the image will fade in again over the video.
I have found an script before that gives this option to put image over youtube video, but it did not had fade effect and it worked for 1 day only. Right now it doesnt works...
Cheers and thank you in advance.
It is possible to build a custome video player using the youtube api. You can handle any events you want, like start stop, pause etc. It's even possible to force the user to click a like button, ads or whatever. But it's a bit of work.
I need to embed video on my site. Div which holds that has got 152/107 px. That why I would like to make navigation bar (play, stop, pause) bottom strip invisible.
Is it possible ?
Add controls=0 to video url.
Didn't test it, but reading the API, then it seems to be the right thing.
Also, here is a link for all the youtube player parameters (autoplay, allow fullscreen etc..)
http://code.google.com/apis/youtube/player_parameters.html
NOTE If you wish to have truly custom player. Then maybe jwplayer is your best choice..
why not use the new iframe player by youtube? the navigation bar hides when you move away with the mouse from it
I have this website which has a slider in the middle of the page. I put a video in the slider but the problem is when I play the video I need the slider to stop its effect so the video can play. Any ideas how to make this happen.
Here is the website it is on.
http://flamingoroadchurch.com.previewdns.com/
You need to attach an event listener to that video somehow. Have you looked at Vimeo's js api?
http://vimeo.com/api/docs/moogaloop
You may want to take a close look at that js_onLoad function.
p.s.: You might get better answers around here if you accepted one. You do this by clicking the little check mark next to an answer.