server/src/remieplt/templates/ldt/ldt_utils/partial/embed_player.html
changeset 17 18ba1a921633
child 172 fc6cb4ccffc4
equal deleted inserted replaced
16:ad85999dd05c 17:18ba1a921633
       
     1 {% spaceless %}
       
     2 {% load i18n %}
       
     3 {% load absurl %}
       
     4 {% load static %}
       
     5 {% load thumbnail %}
       
     6 <div>
       
     7 <div id="{{ player_id }}_embed" class="iri_player_embed">
       
     8 </div>
       
     9 <script type="text/javascript" src='{% static "ldt/metadataplayer/LdtPlayer-core.js" %}'></script>
       
    10 <script type="text/javascript">
       
    11 
       
    12 if (typeof jQuery == "undefined") {
       
    13 	jQuery = IriSP.jQuery;
       
    14 }
       
    15 var metadatas = {metadata: {url: '{{json_url}}{% if "?" in json_url %}&{% else %}?{% endif %}onecontent=1' }};
       
    16 var metadata_key = "metadata";
       
    17 
       
    18 IriSP.libFiles.defaultDir = '{% static "ldt/js/" %}';
       
    19 IriSP.libFiles.locations.jwPlayerSWF = '{% static "ldt/swf/player.swf" %}';
       
    20 IriSP.libFiles.locations.recordMicSwf = '{% static "ldt/swf/record_mic.swf" %}';
       
    21 IriSP.libFiles.locations.zeroClipboardSwf = '{% static "ldt/swf/ZeroClipboard10.swf" %}';
       
    22 IriSP.libFiles.locations.cssjQueryUI = '{% static "ldt/css/jq-css/themes/base/jquery-ui.css" %}';
       
    23 IriSP.language = '{{LANGUAGE_CODE}}';
       
    24 
       
    25 IriSP.widgetsDir = '{% static "ldt/metadataplayer" %}';
       
    26 var _metadata = {
       
    27     url: metadatas[metadata_key].url,
       
    28     format: 'ldt'
       
    29 };
       
    30 var _config = {
       
    31     width: '{{ player_width }}',
       
    32     container: '{{ player_id }}_embed',
       
    33     css: '{% static "ldt/metadataplayer/LdtPlayer-core.css" %}',
       
    34     default_options: {
       
    35         metadata: _metadata
       
    36     },
       
    37     widgets: [
       
    38         {
       
    39             type: "AutoPlayer",
       
    40             default_type: 'AdaptivePlayer',
       
    41     {% if external_url %}
       
    42             video: "{{ external_url }}",
       
    43     {% endif %}
       
    44             height: {% if player_height %}{{ player_height }}{% else %}300{% endif %},
       
    45             autostart: true,
       
    46             url_transform: function(url) {
       
    47                 // Adaptation to jwplayer 6
       
    48                 if(url.substr(url.length - 4).toLowerCase()=='.flv'){
       
    49                     return url.replace('/ddc_player/video/','/ddc_player/flv:video/');
       
    50                 }
       
    51                 return url.replace('/ddc_player/video/','/ddc_player/mp4:video/');
       
    52             }
       
    53         },
       
    54         {
       
    55             type: "Polemic"
       
    56     {% if polemic == 'all' %}
       
    57             ,annotation_type: false
       
    58     {% endif %}
       
    59         },
       
    60     {% if polemic != 'all' %}
       
    61         {
       
    62             type: "Sparkline"
       
    63         },
       
    64     {% endif %}
       
    65         {
       
    66             type: "Slider"
       
    67         },{
       
    68             type: "AnnotationsList",
       
    69             container: "AnnotationsList_ext",
       
    70             ajax_url: "{% absurl 'segment_api_empty' resource_name='segments' api_name='1.0' %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}",
       
    71             ajax_granularity : 300000,
       
    72             default_thumbnail : '{% static "ldt/css/imgs/video_sequence.png" %}',
       
    73             show_audio: true,
       
    74             audio_url_transform: function(url) {
       
    75                 return url.replace("ddc_micro_record/","ddc_micro_record/flv:");
       
    76             }
       
    77         },{
       
    78             type: "Controller"
       
    79         },{
       
    80             type: "MultiSegments"
       
    81             {% if toggle_multisegments %},
       
    82             visible_by_default: false
       
    83             {% endif %}
       
    84         },{
       
    85             type: "Tweet",
       
    86             hide_timeout: 5000
       
    87         }{% if not toggle_multisegments %},{
       
    88             type: "CreateAnnotation",
       
    89             api_endpoint_template: "{% absurl 'api_dispatch_list' resource_name='annotations' api_name='1.0' %}",
       
    90             after_send_timeout: 8000,
       
    91             show_mic_record: {% if show_mic_record %}true{% else %}false{% endif %},
       
    92             close_after_send: false,
       
    93             slice_annotation_type: ["chap","découpage"],
       
    94             creator_name: '{{request.user.username}}',
       
    95             creator_avatar: '{% thumbnail request.user.image "48x48" format="PNG" crop="center" as im %}{{ im.url }}{% endthumbnail %}' || "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png"
       
    96         }{% endif %},{
       
    97             type: "Slideshare",
       
    98             container: "Slideshare_ext",
       
    99             embed_width: 400,
       
   100             embed_height: 334,
       
   101             annotation_type: "slide"
       
   102         },{
       
   103             type: "Mediafragment"
       
   104         },{
       
   105             type: "Social",
       
   106             container: "Social_ext",
       
   107             url: document.location.href.replace(/#.*$/,""),
       
   108             text: document.title
       
   109         }
       
   110         {% if toggle_multisegments %},{
       
   111             type: "Tagcloud",
       
   112             container: "TagcloudContainer",
       
   113             include_titles: false,
       
   114             include_descriptions: false,
       
   115             min_count: 0,
       
   116             tag_count: 100,
       
   117             remove_zero_duration: {% if remove_zero_duration %}true{% else %}false{% endif %}
       
   118         }
       
   119         {% endif %}
       
   120     ]
       
   121 };
       
   122 
       
   123 _myPlayer = new IriSP.Metadataplayer(_config);
       
   124 </script>
       
   125 </div>
       
   126 {% endspaceless %}