Permalink
Browse files

Make sure the preloader does not wait for media players with an undef…

…ined source
  • Loading branch information...
eelco committed Oct 10, 2016
1 parent 81ca90f commit 61c54014a276762a751ff22ab179867c2daf82f3
Showing with 9 additions and 7 deletions.
  1. +9 −7 framer/Extras/Preloader.coffee
@@ -52,13 +52,15 @@ class Preloader extends BaseClass
@_handleProgress()
addPlayer: (player) =>
- if player and player.readyState? and player not in @_media
- if player.readyState < 3
- @_media.push(player)
- # Wait until there is enough data for playback to start playing smoothly
- Events.wrap(player).addEventListener "canplaythrough", =>
- @_mediaLoaded.push(player)
- @_handleProgress()
+ return unless player and player not in @_media
+ return unless player.src? and player.getAttribute('src') isnt "undefined"
+ return unless player.readyState? and player.readyState < 3
+ # … else
+ @_media.push(player)
+ # Wait until there is enough data for playback to start playing
+ Events.wrap(player).addEventListener "canplaythrough", =>
+ @_mediaLoaded.push(player)
+ @_handleProgress()
start: =>
return if @isLoading

0 comments on commit 61c5401

Please sign in to comment.