{% load staticfiles %}
<html>
<head>
<title>Test</title>
<link rel="stylesheet" type="text/css" href="{% static 'remie/css/markers.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'remie/css/markers_student.css' %}" />
</head>
<body>
<div id="remie_player_container">
  <div id="media_panel">  
    <div id="player_container"></div>
    <div id="markers_upper_container"></div>
    <div id="markers_lower_container"></div>
  </div>
  <script type="text/javascript" src='{% static "remie/metadataplayer/LdtPlayer-core.js" %}'></script>
  <script type="text/javascript">
    
    if (typeof jQuery == "undefined") {
        jQuery = IriSP.jQuery;
    }
    var metadatas = {metadata: {url: "{% url 'projectjson_id' id=project_id %}?from_display=false"}};
    var metadata_key = "metadata"; 
    
    IriSP.libFiles.defaultDir = '{% static "remie/js/" %}';
    IriSP.libFiles.inDefaultDir.jQuery = 'jquery.js';
    IriSP.libFiles.locations.jwPlayerSWF = '{% static "remie/swf/player.swf" %}';
    IriSP.libFiles.locations.recordMicSwf = '{% static "remie/swf/record_mic.swf" %}';
    IriSP.libFiles.locations.zeroClipboardSwf = '{% static "remie/swf/ZeroClipboard10.swf" %}';
    IriSP.libFiles.locations.cssjQueryUI = '{% static "remie/css/jq-css/themes/base/jquery-ui.css" %}';
    IriSP.language = 'fr-fr';
   
    IriSP.widgetsDir = '{% static "remie/metadataplayer" %}';
    var _metadata = {
        url: metadatas[metadata_key].url,
        format: 'ldt'
    };
    var _config = {
      container: 'player_container',
      css: '{% static "remie/metadataplayer/LdtPlayer-core.css" %}',
      default_options: {
          metadata: _metadata
      },
      widgets: 
      [
        {
            type: "AutoPlayer",
            streamer: function(_url) {
                var _matches = _url.match(/^[^\/]+\/\/[^\/]+\/[^\/]+\//);
                if (_matches) {
                  return _matches[0];
                } else {
                  return _url;
                }
            },
            url_transform: function(url) {
                // Adaptation to jwplayer 6
                if(url.substr(url.length - 4).toLowerCase()=='.flv'){
                    return url.replace('/ddc_player/video/','/ddc_player/flv:video/');
                }
                return url.replace('/ddc_player/video/','/ddc_player/mp4:video/');
            },
            default_type: "AdaptivePlayer",
            autostart: false
        },{
            type: "Slider"
        },{
            type: "Controller",
            disable_annotate_btn: true,
            disable_search_btn: true,
            disable_ctrl_f: true
        },{
            type: "Markers",
            background: "#ffffff",
            annotation_type: "teacher_markers",
            container: "markers_upper_container",
            line_height: 50,
            project_id: "{{project_id}}",
            allow_empty_markers: true,
            play_on_submit: true,
            custom_send_button: "Sauver",
            preview_mode: true,
            hide_if_empty: true,
        },{
            type: "Markers",
            background: "#ffffff",
            annotation_type: "markers_{{current_user}}",
            container: "markers_lower_container",
            line_height: 50,
            project_id: "{{project_id}}",
            allow_empty_markers: true,
            play_on_submit: true,
            custom_send_button: "Sauver",
            filter_per_user: false,
            preview_mode: true,
        }
      ]
    }
    
    _myPlayer = new IriSP.Metadataplayer(_config);
  
  </script>
</div>
</body>
</html>