{% spaceless %}
{% load i18n %}
{% load thumbnail %}
<div>
<div id="{{ player_id }}_embed" class="iri_player_embed">
</div>
<script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}metadataplayer/LdtPlayer-core.js"></script>
<script type="text/javascript">
  
IriSP.libFiles.defaultDir = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}js/";
IriSP.libFiles.locations.jwPlayerSWF = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}swf/player.swf";
IriSP.libFiles.locations.cssjQueryUI = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}css/jq-css/themes/base/jquery-ui.css"
IriSP.language = '{{LANGUAGE_CODE}}';

IriSP.widgetsDir = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}metadataplayer";
var _metadata = {
    url: '{{ json_url }}',
    format: 'ldt'
};
var _config = {            
    gui: {
        width: '{{ player_width }}',
        container: '{{ player_id }}_embed',
        css: '{{WEB_URL}}{{LDT_MEDIA_PREFIX}}css/LdtPlayer-core.css',
        default_options: {
            metadata: _metadata
        },
        widgets: [
            {
                type: "Polemic"
            },{
                type: "Sparkline"
            },{
                type: "Slider"
            },{
                type: "AnnotationsList",
                container: "annot_media",
                ajax_url: "{% url segment_api_empty %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}"
            },{
                type: "Controller"
            },{
                type: "Segments"
            },{
                type: "Slice"
            },{
                type: "Arrow",
                base_height: 4
            },{
                type: "Annotation"
            },{
                type: "Tweet"
            },{
                type: "CreateAnnotation",
                api_endpoint_template: "{% url annotation_api_empty %}{% templatetag openvariable %}id{% templatetag closevariable %}.json",
                tag_titles: ["#amateur", "#digital-humanities"],
                creator_name: '{{request.user.username}}',
                creator_avatar: '{% thumbnail request.user.get_profile.image "48x48" format="PNG" crop="center" as im %}{{WEB_URL}}{{ im.url }}{% endthumbnail %}'
            },{
                type: "Slideshare",
                container: "slides_container",
                embed_width: 400,
                embed_height: 334
            },{
                type: "Mediafragment"
            }
        ]
    },
    player: {
    {% if external_url %}
        video: '{{ external_url }}',
    {% endif %}
        type:'auto',
        live: true, 
        height: 300, 
        width: '{{ player_width }}', 
        provider: "rtmp",
        autostart: true,
        metadata: _metadata
    }
};

_myPlayer = new IriSP.Metadataplayer(_config);
</script>
</div>
{% endspaceless %}
