forked from HeinrichApfelmus/threepenny-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVideoAnnotate.hs
51 lines (39 loc) · 1.33 KB
/
VideoAnnotate.hs
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
{-# LANGUAGE RecordWildCards #-}
import Control.Monad
import Control.Monad.IO.Class
import qualified Data.Map as Map
import qualified Graphics.UI.Threepenny as UI
import Graphics.UI.Threepenny.Core
import Paths
import VideoAnnotate.MediaPlayer
type Map = Map.Map
{-----------------------------------------------------------------------------
UI
------------------------------------------------------------------------------}
main :: IO ()
main = do
static <- getStaticDir
startGUI defaultConfig
{ tpPort = 10000
, tpStatic = Just static
} setup
setup :: Window -> IO ()
setup w = do
return w # set title "Video Annotations"
body <- getBody w
withWindow w $ do
filename <- UI.input
load <- UI.button # set text "Load"
video <- mkMediaPlayer
element body #+ [column
[ row [element filename, element load]
, view video
]]
liftIO $ on UI.click load $ \_ -> do
path <- get value filename
uri <- loadFile w "video/mp4" path
return video # set source uri
{-----------------------------------------------------------------------------
Logic
------------------------------------------------------------------------------}
type Annotations = Map Time String