Combine two clips from two different videos into one video with javascript (client side)?
Asked Answered
D

1

5

Does anyone know if this is possible?

The closest thing I found to what I am looking for is this: http://bgrins.github.io/videoconverter.js/

But the "docs" are very minimal.

Dandruff answered 19/5, 2017 at 3:51 Comment(2)
What do you mean by "combine"?Philippians
split screen, or like a collageDandruff
N
7

You can add 2 videos in one video element

var myvid = document.getElementById('myvideo');
var myvids = [
  "http://www.w3schools.com/html/mov_bbb.mp4", 
  "http://www.w3schools.com/html/movie.mp4"
  ];
var activeVideo = 0;

myvid.addEventListener('ended', function(e) {
  // update the new active video index
  activeVideo = (++activeVideo) % myvids.length;

  // update the video source and play
  myvid.src = myvids[activeVideo];
  myvid.play();
});
<video src="http://www.w3schools.com/html/mov_bbb.mp4" id="myvideo" width="320" height="240" controls style="background:black">
</video>
Numbles answered 19/5, 2017 at 4:5 Comment(1)
I feel that this response, while well documented, misses the point. What the above does is merely change the 'src' attribute of the video, but the sources themselves are still two separate videos, not a combined one.Seraphic

© 2022 - 2024 — McMap. All rights reserved.