Media Types/Display

Media type display pages are media type-specific Jinja2 templates defined in the media type's.

Set the template path
The path for the media type display template is configured in the  object for each media type. The  is configured in.


 * The path to the template should be relative to the  directory.
 * The standard directory for media templates is

This is an example of a  dict, see the   key.

MEDIA_MANAGER = { "human_readable": "Video", "processor": process_video, "sniff_handler": sniff_handler, "display_template": "mediagoblin/media_displays/video.html", "default_thumb": "images/media_thumbs/video.jpg", "accepted_extensions": [ "mp4", "mov", "webm", "avi", "3gp", "3gpp", "mkv", "ogv", "m4v"]}

Create the template
The medie templates are Jinja2 templates that extend upon the template. They contain media-type-specifig markup used to display the media.

This is an example of such a template.

{#
 * 1) GNU MediaGoblin -- federated, autonomous media hosting
 * 2) Copyright (C) 2011, 2012 MediaGoblin contributors.  See AUTHORS.
 * 3) This program is free software: you can redistribute it and/or modify
 * 4) it under the terms of the GNU Affero General Public License as published by
 * 5) the Free Software Foundation, either version 3 of the License, or
 * 6) (at your option) any later version.
 * 7) This program is distributed in the hope that it will be useful,
 * 8) but WITHOUT ANY WARRANTY; without even the implied warranty of
 * 9) MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * 10) GNU Affero General Public License for more details.
 * 11) You should have received a copy of the GNU Affero General Public License
 * 12) along with this program.  If not, see .
 * }
 * 1) You should have received a copy of the GNU Affero General Public License
 * 2) along with this program.  If not, see .
 * }

{% extends 'mediagoblin/user_pages/media.html' %}

{% block mediagoblin_head %}   {% endblock %}

{% block mediagoblin_media %}    {%- trans -%}Sorry, this video will not work because your web browser does not support HTML5 video.{%- endtrans -%} {%- trans -%}You can get a modern web browser that can play this video at  http://getfirefox.com!{%- endtrans -%} {% if 'original' in media.media_files %}  {%- trans -%} Original {%- endtrans -%}  {% endif %} {% endblock %}