<html>
<head>
    <meta charset="UTF-8">
    <title>Piano Roll {{event.label}}</title>
    <link href="{{ config['STATIC_URL'] }}/css/annotviz.min.css" rel="stylesheet">
</head>
<body>
    <h1>Piano Roll {{event.label}}</h1>
    <noscript>You must enable JavaScript</noscript>
    <div id="canvasContainer"></div>
    <pre id="log"></pre>
    <script src="{{ config['STATIC_URL'] }}/js/libs-annotviz.min.js"></script>
    <script src="{{ config['STATIC_URL'] }}/js/annotviz.min.js"></script>
    <script>

    var pianorollChannel  = 'PIANOROLL';
    var annotationChannel = 'ANNOT';
    var eventCode = '{{event.code}}';
    var eventCodeSessionDay2 = 'atelier3_jour2';
    var eventCodeSessionDay1 = 'atelier3_jour1';
    
    var wsUri = 'ws://' + window.location.hostname + ':8090/broadcast';

    wsUriPianoroll = wsUri + '?channel=' + pianorollChannel + '&event_code=' + eventCode;
    wsUriAnnotation = wsUri + '?channel=' + annotationChannel + '&event_code=' + eventCode;

    var logger = new annotviz.ConsoleLogger(true);

    var stageView = new annotviz.StageView({
        logger: logger
    });

    var serverUrl = "http://" + window.location.hostname + ":8080";
    var annotsvizview = new annotviz.AnnotsVizView({
        urlCategories: serverUrl + "/p/api/v1/event/",
        logger: logger,
        stageView: stageView,
        serverUrl: serverUrl,
        wsPianoroll: new annotviz.WsWrapper(wsUriPianoroll, logger),
        wsAnnot: new annotviz.WsWrapper(wsUriAnnotation, logger),
        timeBegin: Date.parse("2015-04-18T10:00:00+02:00"),
        timeEnd: Date.parse("2015-04-18T18:00:00+02:00"),
        eventCode: eventCode,
        eventCodeSessionDay2: eventCodeSessionDay2,
        eventCodeSessionDay1: eventCodeSessionDay1,
        channel: annotationChannel
    });


    function stop() {
        stageView.stop();
    }
    function start() {
        stageView.start();
    }

    window.onload = function() {
        stageView.init();
        start();
    }
</script>
</body>
</html>
