Skip to content
This repository has been archived by the owner on Jan 8, 2021. It is now read-only.

Commit

Permalink
Merge pull request #3 from avalonmediasystem/mejs-time-clip
Browse files Browse the repository at this point in the history
Limit clip offsets to between 0 and 100 percent
  • Loading branch information
cjcolvar authored Feb 27, 2017
2 parents 9c5b35e + c7ac4c5 commit 8b9b094
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/assets/javascripts/me-track-scrubber.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
duration = stream_info.duration
trackduration = trackend - trackstart
$currentTime = $('.track-mejs-currenttime')
$currentTime.text(mejs.Utility.secondsToTimeCode(this.getCurrentTime()-trackstart, false))
$currentTime.text(mejs.Utility.secondsToTimeCode(Math.max(0,this.getCurrentTime()-trackstart), false))
this.trackdata = {}
this.trackdata['starttime'] = trackstart
this.trackdata['endtime'] = trackend
Expand All @@ -52,8 +52,8 @@
$duration = $('.track-mejs-duration')
$duration.text(mejs.Utility.secondsToTimeCode(parseInt(trackduration), false))

start_percent = Math.round(100*trackstart / duration)
end_percent = Math.round(100*trackend / duration)
start_percent = Math.max(0,Math.min(100,Math.round(100*trackstart / duration)))
end_percent = Math.max(0,Math.min(100,Math.round(100*trackend / duration)))
clip_span = $('<span />').addClass('mejs-time-clip')
trackbubble = $('<span class="mejs-time-clip">')
trackbubble.css 'left', start_percent+'%'
Expand Down

0 comments on commit 8b9b094

Please sign in to comment.