Load multiple videos without playing - javascript

I'm building a video player where each scene is filmed from multiple angles. All videos are hosted on YouTube. I'd like to allow the user to be able to switch between angles seamlessly during playback.
To facilitate this, I need a way to load videos from YouTube without playing them. That way I can load alternate angles in the background while one angle is playing. When the user switches angle, the new angle should be at least partially loaded and ready to play immediately.
Unfortunately, I can't find a way to load a video without playing it.
The loadVideoById method autoplays the video as soon as the request to load the video has returned so that won't work.
Is this possible?

There's no way to cue up a video and force it to pre-buffer.
You can load (as opposed to cue) a video and then immediately pause it, and it may or may not pre-buffer, but that's dependent on a number of factors and is outside your control as someone using the API.

Related

On video.js Is it possible to pre-load a video while you have an existing video playing (without having two video.js instances)

We are using video.js to play through a playlist of videos in a continuous fashion. Sometimes the buffering time between the next ad or video can be quite long when a video ends and the next one begins. Is it possible to prebuffer/preload the next video while the existing one plays. One idea would be to use a separate video player and swap back and forth between but that seems quite complex. Is there any way to do this without having two instances (or is their a plugin that makes managing two video.js instances seamless?)

flag start point and end point of streaming video node.js

I'm trying to write a nodejs website for streaming html5 video (webm, mp4). But don't know how to know when user finished viewing video. That mean, we need a start point (the point that user start to view video), and an end point(the point that user finished to view video). And we can know how many percents that they are viewed the video.
The video are located at our server.
The video HTML element (which is a subclass of MediaElement) has currentTime and duration properties that you can look at in JavaScript, and also a bunch of events you can listen for, like onplay, onplaying, onpause, ontimeupdate, etc.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement

javascript image slideshow, video like playback

I want to take a video and dump it into seperate frames and then create a Javascript/HTML5 player that can play through a sequence of images.
Key reasons I want to use images is to allow for an all keyframes style fast forward and rewind for use in a slow motion player and also for use in video editing where you need to be able to skip to any keyframe.
Any suggestions appreciated.

Seek video position width video from another domain

http://www.67games.com/video.html
You will notice after the video starts that if you try to jump to another position in the video it will reset and start over. So that is the problem.
As you can see the source is external. This uses JW PLayer, but I have tried with other players to.
I have tried with other hosts and video formats and its the same issue.
Can somebody help me with this cause I'm stuck?
I don't think the source media file being on another server/domain has anything to do with your problem.
You have a progressive download video here, and seeks just fine to the point of download. Yes, it does restart from the beginning if you try and seek past the last downloaded mark, but that is to be expected. (How could a client seek into data it doesn't even have yet?)
You have two choices:
Tweak the player so that it never attempts to seek beyond the last downloaded point. If you are only going to have clips this small that this solution seems fine.
Put the clip behind a streaming or psedu streaming server. (More appropriate for longer clips.)
Streaming: red5, Wowza, FMS, etc
Pseudo streaming: apache/lighttpd/etc with mod_h264_streaming + some client side logic denote the position to stream to

Multiple audio tracks for HTML5 video

I'm building a video for my website with HTML5. Ideally, I'd have only one silent video file, and five different audio tracks in different languages that sync up with the video.
Then I'd have a button that allows users to switch between audio tracks, even as the video is playing; and the correct audio track would come to life (without the video pausing or starting over or anything; much like a DVD audio track selection).
I can do this quite simply in Flash, but I don't want to. There has to be a way to do this in pure HTML5 or HTML5+jQuery. I'm thinking you'd play all the audio files at 0 volume, and only increase the volume of the active track... but I don't know how to even do that, let alone handle it when the user pauses or rewinds the video...
Thanks in advance!
Synchronization between audio and video is far more complex than simply starting the audio and video at the same time. Sound cards will playback at slightly different rates. (What is 44.1 kHz to me, might actually be 44.095 kHz to you.)
Often, the video is synchronized to the audio stream, but the player is what handles this. By loading up multiple objects for playback, you are effectively pulling them out of sync.
The only way this is going to work is if you can find a way to control the different audio streams from the video player. I don't know if this is possible.
Instead, I propose that you encode the video multiple times, with the different streams. You can use FFMPEG for this, and even automate the process, depending on your workflow. Switching among streams becomes a problem, but most video players are robust enough to guess the byte offset in the file, when given the bitrate.
If you only needed two languages, you could simply adjust the balance between a left and right stereo audio channel.
If you're willing to let all five tracks download, why not just mux them into the video? Videos are not limited to a single audio track (even AVI could do multiple audio tracks). Then syncing should be handled for you. You'd just enable/disable the audio tracks as needed.
It is doable with Web Audio API.
Part of my program listens to video element events and stops or restarts audio tracks created using web audio API. This gives me an ability to turn on and off any of the tracks in perfect sync.
There are some drawbacks.
There is no Web Audio API support in Internet Explorers except for Edge.
The technique works with buffered audio only and that's limiting. There are some problems with large files: https://bugs.chromium.org/p/chromium/issues/detail?id=71704

Categories