Skip to content

Dynamically changing the source URL of the video is not working on IOS #8996

Answered by amtins
hebrerillo asked this question in Q&A
Discussion options

You must be logged in to vote

@hebrerillo what about something like:

const urlVideo2 = "https://videos.pexels.com/video-files/2278095/2278095-sd_640_360_30fps.mp4";
const videoElement = document.querySelector("video");

const videoJSInstance = videojs(videoElement);
videoJSInstance.on("loadeddata", () => videoJSInstance.play());

document.querySelector("[data-play]").addEventListener("click", () => {
  videoJSInstance.play();
});

const change = document.querySelector("[data-change]");
change.addEventListener("click", () => {
  videoJSInstance.src([ {type: "video/mp4", src:urlVideo2} ]);
  videoJSInstance.play();
});

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@gkatsev
Comment options

@hebrerillo
Comment options

Answer selected by hebrerillo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants