]> cat aescling's git repositories - mastodon.git/commitdiff
Fix an error when video playback buffer is empty (#5300)
authorunarist <m.unarist@gmail.com>
Tue, 10 Oct 2017 13:17:53 +0000 (22:17 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 10 Oct 2017 13:17:53 +0000 (15:17 +0200)
app/javascript/mastodon/features/video/index.js

index 8b83fb66ba69e4bd43deb8353d7f370f20856109..003bf23a84fffffd2177343d08ad31ad68435dfe 100644 (file)
@@ -210,7 +210,9 @@ export default class Video extends React.PureComponent {
   }
 
   handleProgress = () => {
-    this.setState({ buffer: this.video.buffered.end(0) / this.video.duration * 100 });
+    if (this.video.buffered.length > 0) {
+      this.setState({ buffer: this.video.buffered.end(0) / this.video.duration * 100 });
+    }
   }
 
   handleOpenVideo = () => {