{% extends "spel_base.html" %}
{% load static %}

{% block page_title %}Corpus{% endblock %}

{% block spel_content %}
   <section style="width: 1070px; margin: 0 auto">
        <!-- <h1>Tests Spectacle en ligne(s)</h1> -->
        <div id="LdtPlayer"></div>
        <div id="AnnotationsListContainer"></div>
    </section>
    <script type="text/javascript" src="{% static 'spel/lib/jquery.min.js' %}"></script>
    <script type="text/javascript" src="{% static 'spel/lib/jquery-ui.min.js' %}"></script>
    <script type="text/javascript" src="{% static 'spel/metadataplayer/LdtPlayer-core.js' %}"></script>
    <!--script type="text/javascript" src="{% static 'spel/metadataplayer/spel-serializer.js' %}"></script-->
    <script type="text/javascript">
    function getURLParameter(name) {
        return decodeURI(
            (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
        );
    }
    $(document).ready(function(){
        // Get group array number
        var g = getURLParameter("g");
        var d = getURLParameter("d");
        var f = getURLParameter("f");
        var p = getURLParameter("p");// project id
        if(typeof g=="string"){
            
            IriSP.libFiles.defaultDir = "{% static 'spel/lib' %}";
            IriSP.widgetsDir = "{% static 'spel/metadataplayer' %}";
            var _metadata = {
                //url: "/data/" + d + "/" + g + "/cinelab" + ( (d!="opera") ? "_iri" : "" ) + ".json",
                url: "{% url 'projectjson_id' id='' %}" + p,
                //format: 'spel'
                format: 'ldt'
            };
            var _config = {
                width : 550,
                container : 'LdtPlayer',
                default_options: {
                    metadata: _metadata
                },
                css : "{% static 'spel/metadataplayer/LdtPlayer-core.css' %}",
                widgets: [
                    {
                        type: "Title"
                    },
                    {
                        type: "HtmlPlayer", /*ou HtmlPlayer si HTML5*/
                        video: "/data/" + d + "/" + g + "/" + f,
                        height: 320
                    },
                    { type: "Slider" },
                    { type: "Controller" },
                    {
                        type: "MultiSegments",
                        //annotation_type: ["performance","discussion"]
                    },/*
                    {
                        type: "Annotation",
                        show_social: false,
                        show_annotation_type: true,
                        //annotation_type: ["performance","discussion"]
                    },
                    {
                        type: "Polemic",
                        annotation_type: "interpretation",
                        only_allow_zero_duration_annotations: false,
                        polemics: [
                            {
                                keywords: [ "performance d'un(e) comédien(ne)" ],
                                color: "#c00000"
                            },
                            {
                                keywords: [ "Interpétation alternative de mise en scène" ],
                                color: "#008000"
                            },
                            {
                                keywords: [ "Intervention de la technique" ],
                                color: "#0000f0"
                            },
                            {
                                keywords: [ "intervention MES" ],
                                color: "#a6cee3"
                            },
                            {
                                keywords: [ "Adaptation du texte" ],
                                color: "#1f78b4"
                            },
                            {
                                keywords: [ "scène reprise" ],
                                color: "#b2df8a"
                            },
                            {
                                keywords: [ "Identification d'un problème" ],
                                color: "#33a02c"
                            },
                            {
                                keywords: [ "Improvisation" ],
                                color: "#fb9a99"
                            },
                            {
                                keywords: [ "Décision" ],
                                color: "#e31a1c"
                            },
                            {
                                keywords: [ "Allemande de la scène" ],
                                color: "#fdbf6f"
                            },
                            {
                                keywords: [ "Filage de la scène" ],
                                color: "#ff7f00"
                            },
                            {
                                keywords: [ "Question d'espace" ],
                                color: "#cab2d6"
                            },
                            {
                                keywords: [ "Conflit" ],
                                color: "#6a3d9a"
                            },
                            {
                                keywords: [ "Référence au réel" ],
                                color: "#ffff99"
                            },
                            {
                                keywords: [ "Adaptation du texte" ],
                                color: "#b15928"
                            },
                            {
                                keywords: [ "Parole à l'acteur/acrtrice" ],
                                color: "#8e0152"
                            },
                            {
                                keywords: [ "Demande d'un(e) comédien(ne)" ],
                                color: "#7f3b08"
                            },
                            {
                                keywords: [ "Doutes" ],
                                color: "#80cdc1"
                            },
                            {
                                keywords: [ "Intervention assistant metteur en scène" ],
                                color: "#ffffcc"
                            },
                            {
                                keywords: [ "Remise en cause" ],
                                color: "#0000f0"
                            },
                        ]
                    },
                    {
                        type: "Annotation",
                        annotation_type: "interpretation",
                        show_social: false,
                        arrow_position: 0
                    },*/
                    {
                        type: "SpelSyncHtml",
                        container: "AnnotationsListContainer",
                        height: 600,
                        width: 500,
                        src: ( (d!="opera") ? "{% url 'spel_ctb' %}" : "")
                    },
                    {
                        type: "Mediafragment"
                    }
                ]
            };
            _myPlayer = new IriSP.Metadataplayer(_config);
        }
    });
    </script>
{% endblock %}