<jupyter_start><jupyter_text>Compound Video Player Widget Most everything in this notebook is a work in progress.<jupyter_code>import os
import IPython
import ipywidgets

# import nutmeg

from jpy_video import Video, TimeCode, compound
# Display cells full width

txt = """
<style>
    div#notebook-container    { width: 95%; }
    div#menubar-container     { width: 65%; }
    div#maintoolbar-container { width: 99%; }
</style>
"""

IPython.display.display(IPython.display.HTML(data=txt))<jupyter_output><empty_output><jupyter_text>Setup<jupyter_code>f = '/home/pierre/Projects/GoProHelper/notebooks/data/GOPR8802.intra.mp4'

os.path.isfile(f)
fps = 59.9
wid = compound.VideoPlayer(f, 1/fps)
wid.display()
wid.wid_video.
wid.wid_timecode.layout.top
wid.wid_info
wid.wid_timecode._model_module_version<jupyter_output><empty_output><jupyter_text>Components<jupyter_code># HTML5 video widget
wid_video = Video(f)
wid_video.set_property('controls', False)

# Timecode
wid_timecode = TimeCode()

# Slider
wid_slider = ipywidgets.FloatSlider(step=1/fps, continuous_update=True, readout=False)
wid_slider.layout.width='500pt'


        # wid_button = ipywidgets.Button(icon='play')  # http://fontawesome.io/icon/pause/

        # self.wid_slider = ipywidgets.FloatSlider(min=0, max=60, step=timebase,
        #                                          continuous_update=True, orientation='horizontal',
        #                                          readout=False,
        #                                          slider_color='blue')
        # self.wid_slider.layout.width = '50%'<jupyter_output><empty_output><jupyter_text>Assemble<jupyter_code>wid_controls = ipywidgets.HBox(children=[wid_timecode, wid_slider])
wid_outer = ipywidgets.VBox(children=[wid_video, wid_controls])

# Link widgets at front end
ipywidgets.jslink((wid_video, 'current_time'), (wid_slider, 'value'))
ipywidgets.jsdlink((wid_video, 'current_time'), (wid_timecode, 'timecode'))<jupyter_output><empty_output><jupyter_text>Event Handlers<jupyter_code># def handle_any(wid, **event):
#     """Respond to any event type
#     """
#     update_timecode(wid_time, wid_video.properties.currentTime)

    
def handle_displayed(wid, **event):
    """Do stuff that can only be done after widget is displayed
    """
    wid.set_property('controls', False)


def handle_loaded_metadata(wid, **event):
    """Function to be called when sufficient video metadata has been loaded at the frontend
    """
    pass
#     print(wid.properties)


def handle_duration_change(wid, **event):
    """Update anything that depends on video duration
    """
    wid_slider.max = wid.properties.duration
    
    
wid_video.on_displayed(handle_displayed)
# wid_video.on_event(handle_any)
wid_video.on_event(handle_loaded_metadata, 'loadedmetadata')
wid_video.on_event(handle_duration_change, 'loadedmetadata')
wid_video.on_event(handle_duration_change, 'durationchange')<jupyter_output><empty_output>