forked from plotly/dash-player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusage.py
65 lines (48 loc) · 1.53 KB
/
usage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import dash_player
import dash
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output
app = dash.Dash(__name__)
app.scripts.config.serve_locally = True
app.layout = html.Div([
dash_player.DashPlayer(
id='video-player',
url='http://media.w3.org/2010/05/bunny/movie.mp4',
controls=True
),
dcc.Checklist(
id='radio-bool-props',
options=[{'label': val.capitalize(), 'value': val} for val in [
'playing',
'loop',
'controls',
'muted',
'seekTo'
]],
values=['controls']
),
])
@app.callback(Output('video-player', 'playing'),
[Input('radio-bool-props', 'values')])
def update_prop_playing(values):
return 'playing' in values
@app.callback(Output('video-player', 'loop'),
[Input('radio-bool-props', 'values')])
def update_prop_loop(values):
return 'loop' in values
@app.callback(Output('video-player', 'controls'),
[Input('radio-bool-props', 'values')])
def update_prop_controls(values):
return 'controls' in values
@app.callback(Output('video-player', 'muted'),
[Input('radio-bool-props', 'values')])
def update_prop_muted(values):
return 'muted' in values
@app.callback(Output('video-player', 'seekTo'),
[Input('radio-bool-props', 'values')])
def update_prop_seekTo(values):
if 'seekTo' in values:
return 5
if __name__ == '__main__':
app.run_server(debug=True)