Download Latest Version v2.0.0 source code.zip (235.6 kB)
Email in envelope

Get an email when there's a new version of youtube-background

Home / v1.2.1
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2026-08-30 1.5 kB
v1.2.1 source code.tar.gz 2026-08-30 211.7 kB
v1.2.1 source code.zip 2026-08-30 232.4 kB
Totals: 3 Items   445.5 kB 0

setSource() replaced the player's src and left everything else standing. The new video came back muted after the visitor had unmuted, it no longer looped, and a plain video file did not change at all.

Fixed

  • setSource() goes through the player API, not the iframe src. A new src navigates the iframe away from the document the YouTube and Vimeo APIs shook hands with, so state changes stopped arriving and the loop went with them. YouTube now swaps with loadVideoById, or cueVideoById for a video neither playing nor due to start, and Vimeo with loadVideo — the player survives, and so do its mute state and volume.

  • A swap before the player exists carries the live state into the URL. That one path still assigns src, but it now reads the current mute and pause state rather than the muted and autoplay parameters the instance started with.

  • A <video> file actually changes. setSource() swapped the <source> child, which the browser only reads while running its load algorithm, so the old file played on; the element is reloaded now, autoplay taken off it first when it is to wait, and resumes playing if it was playing.

  • The replaced video leaves no duration behind. Duration and progress carried over from the old video, so a longer replacement was cut short at the old length.

Full Changelog: https://github.com/stamat/youtube-background/compare/v1.2.0...v1.2.1

Source: README.md, updated 2026-08-30