client/annotviz/app/annotsvizview.html
author rougeronj
Thu, 22 Jan 2015 15:03:58 +0100
changeset 121 df6b39f962bc
parent 117 c0034b35c44e
child 122 3b11017a76a4
permissions -rw-r--r--
Add getAnnotCategories to utils and propagate the modification to annotsvizview and annotstimeline

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="I.R.I">
    <link rel="shortcut icon" href="/img/favicon.ico">

    <title>AnnotsVizView</title>

    <!-- Custom styles for this template -->
    <link href="/css/annotviz.css" rel="stylesheet">
</head>

<body>
    <h1>Piano Roll vertical</h1>
    <noscript>You must enable JavaScript</noscript>
    <div id="canvasContainer"></div>
    <!--pre id="log"></pre-->
    <script src="/js/libs-annotviz.js"></script>
    <script src="/js/annotviz.js"></script>
    <script>

        var PIXI = require('pixi');

        function colorToHex(input) {
            if (input.substring(0, 1) === '#') {
                return input;
            }
            else {
                var m = input.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
                var r = m[1], g=[2], b=[3];
                return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
            }
        }

	    var pianorollChannel  = 'PIANOROLL';
	    var annotationChannel = 'ANNOT';
	    var eventCode = 'atelier2';
	    var serverUrl = "http://172.16.0.20:8080";
	    var wsUri;
	    
	    if (window.location.protocol === 'file:') {
	        wsUri = 'ws://172.16.0.20:8090/broadcast';
	    }
	    else {
	        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 annotsvizview = new annotviz.AnnotsVizView({
        	urlCategories: serverUrl + "/p/api/v1/event/" + eventCode,
        	logger: logger,
        	stageView: stageView,
        	wsPianoroll: new annotviz.WsWrapper(wsUriPianoroll, logger),
        	wsAnnot: new annotviz.WsWrapper(wsUriAnnotation, logger),
        	timeBegin: 1421919000000,
        	timeEnd: 1421951400000
        });


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

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