 
   # set up the chapter elements
   displayChapters = ->
-    if chaptersElement.readyState >= 1 and
+    if chaptersElement.readyState == 2 and
     (chaptersTrack = chaptersElement.track)
       chaptersTrack.mode = 'hidden'
       i = 0


  # after video metadata have been loaded, display chapters and metadata in the
  # interactive area
  $(video).on 'loadedmetadata', ->
    console.log 'chapters.readyState:' + chaptersElement.readyState
    console.log 'metadata.readyState:' + metadataElement.readyState
    console.log 'video.readyState:' + video.readyState
    if video.readyState >= 1
      displayChapters()
      displayMetadata()
    else
      alert($('body').data('nometadata'))
  return

$(document).on 'turbolinks:load', ->


  # set up the metadata elements
  displayMetadata = ->
    if metadataElement.readyState == 2 and (metaTrack = metadataElement.track)
      metaTrack.mode = 'hidden'
      i = 0
      times = []
