Skip to content

Instantly share code, notes, and snippets.

@osdrv
Created March 11, 2012 10:39
Show Gist options
  • Save osdrv/2015948 to your computer and use it in GitHub Desktop.
Save osdrv/2015948 to your computer and use it in GitHub Desktop.
onVideoCanplay = () ->
this.play()
onVideoLoaded = () ->
# I had 2 video layers: foreground video which is playing and background video which is loading data and waiting to be displayed
if isVideoOnTop( this )
this.play()
else
this.pause()
# some foreground and background videos change logick here
videos = document.querySelectorAll( "video" )
for video in videos
video.addEventListener( "loadeddata", onVideoLoaded, false )
video.addEventListener( "canplay", onVideoCanplay, false )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment