diff options
author | Florian Larysch | 2017-01-03 16:36:33 +0100 |
---|---|---|
committer | Florian Larysch | 2017-01-03 16:36:33 +0100 |
commit | 56a2420e47f9434b4c91b17e81a36fb4e6fe887d (patch) | |
tree | 5d00800a80a0f9ebf02c9663ceb7d8a87fc2a653 | |
parent | 00990497857e5ec27405e2b795310fa0dc925545 (diff) |
relive: handle missing scrub thumbs correctly
Previously, when relive didn't supply a sprites file to the player, we'd
simply pass undefined into buildSpriteConfig, which only worked because
of the way the arguments are handled internally in that function, but
does not represent a proper use of the plugin's API.
Instead, we now manually check whether relive has supplied a sprites
file and explicitly pass an empty thumbs array to the plugin in such a
case.
-rw-r--r-- | assets/js/lustiges-script.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/assets/js/lustiges-script.js b/assets/js/lustiges-script.js index e949c6e..1693cbd 100644 --- a/assets/js/lustiges-script.js +++ b/assets/js/lustiges-script.js @@ -21,6 +21,18 @@ $(function() { var $relivePlayer = $('body.relive-player .video-wrap'); if($relivePlayer.length > 0) { + var sprites = []; + + if($relivePlayer.data("sprites")) { + sprites = ClapprThumbnailsPlugin.buildSpriteConfig( + $relivePlayer.data("sprites"), + $relivePlayer.data("sprites-n"), + 160, 90, + $relivePlayer.data("sprites-cols"), + $relivePlayer.data("sprites-interval") + ); + } + var player = new Clappr.Player({ baseUrl: 'assets/clapprio/', plugins: { @@ -34,13 +46,7 @@ $(function() { scrubThumbnails: { backdropHeight: 64, spotlightHeight: 84, - thumbs: ClapprThumbnailsPlugin.buildSpriteConfig( - $relivePlayer.data("sprites"), - $relivePlayer.data("sprites-n"), - 160, 90, - $relivePlayer.data("sprites-cols"), - $relivePlayer.data("sprites-interval") - ), + thumbs: sprites }, events: { onReady: function() { |