How would you embed a static file with .m4v extension , M4V is a file format,
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="320" height="256" >
<param name="src" value="/static/example.m4v">
<param name="autoplay" value="false">
<param name="controller" value="true">
<embed src="/static/example.m4v" type="video/mp4" width="320" height="256" controller="true" controls="true" autostart="false"/>
</object>
The above example forces it to download.
http://django-embed-video.readthedocs.org/en/v0.11/index.html only works with online sites like youtube, few others.
I was struggling with this same issue. I pretty much copied the code from http://camendesign.com/code/video_for_everybody.
<!-- first try HTML5 playback: if serving as XML, expand `controls` to `controls="controls"` and autoplay likewise -->
<!-- warning: playback does not work on iOS3 if you include the poster attribute! fixed in iOS4.0 -->
<video width="640" height="360" controls>
<!-- MP4 must be first for iPad! -->
<source src="__VIDEO__.MP4" type="video/mp4" /><!-- Safari / iOS video -->
<source src="__VIDEO__.OGV" type="video/ogg" /><!-- Firefox / Opera / Chrome10 -->
<!-- fallback to Flash: -->
<object width="640" height="360" type="application/x-shockwave-flash" data="__FLASH__.SWF">
<!-- Firefox uses the `data` attribute above, IE/Safari uses the param below -->
<param name="movie" value="__FLASH__.SWF" />
<param name="flashvars" value="controlbar=over&image=__POSTER__.JPG&file=__VIDEO__.MP4" />
<!-- fallback image. note the title field below, put the title of the video there -->
<img src="__VIDEO__.JPG" width="640" height="360" alt="__TITLE__"
title="No video playback capabilities, please download the video below" />
</object>
</video>
<!-- you *must* offer a download link as they may be able to play the file locally. customise this bit all you want -->
<p> <strong>Download Video:</strong>
Closed Format: "MP4"
Open Format: "Ogg"
</p>
Then made sure to create .htaccess file with the following:
AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm
Also, I'm using an older version of django (1.6.5) for my project and I have my videos stored at my MEDIA_ROOT and have the MEDIA_URL also set in the settings.py so that the source of video looks like:
{{ MEDIA_URL }}/media/videos/video.m4v
Related
I add file as <audio src="LINK" controls /> to mysql.
When I fetch mysql row it not show audio player but show text <audio src="LINK" controls /> instead of embeded audio player
My problem is that the browser downloads the pdf instead of displaying it.
I tried some solutions from this site (for example) but none of them worked for me.
I use this code in my html file and nothing else:
{% load static %}
<body>
<object data="test.pdf" type="application/pdf" title="SamplePdf" width="500" height="720">
<embed src="{% static 'test.pdf' %}" >
</object>
</body>
Ideas?
Displaying PDF has nothing in common with Django, you can handle it with pure HTML:
Recommended way to embed PDF in HTML?
Have you tried:
<embed src="{% static 'test.pdf' %}" width="500" height="375"
type="application/pdf">
?
I would like add youtube video in my "xml_bloc" here my code
[CustomTagSettings]
AvailableCustomTags[]=youtube
IsInline[youtube]=true
The news tags "youtube is visible in my back office. Here the template content "youtube.tpl"
<div class="video">
<object width="{$width}" height="{$height}" type="application/x-shockwave-flash" data="{$content}">
<param name="movie" value="{$content}"></param>
<param name="allowfullscreen" value="true"></param>
</object>
</div>
My question is where i save my template templates/content/view/datatype/ezxmltags/youtube.tpl ?
Thank you in advance for your help.
Looks like you didn't share all your content.ini code, like where you declare your variables, but I am assuming you have that part right. It also looks like your location is correct.
extension/<your_extension>/design/ezflow/templates/content/datatype/view/ezxmltags/youtube.tpl
Are you experiencing problems with the custom tag? Did you remember to clear the cache?
it's works, i have try this code
[CustomTagSettings]
AvailableCustomTags[]=youtube
CustomTagsDescription[youtube]=YouTube video
[youtube]
CustomAttributes[]=video_id
CustomAttributes[]=width
CustomAttributes[]=height
<div class="object-center">
<object type="application/x-shockwave-flash" width="{$width|wash}" height="{$height|wash}" data="http://www.youtube.com/v/{$video_id|wash}&hl=en&fs=1&rel=0&color1=0x666666&color2=0xf15e22">
<param name="movie" value="http://www.youtube.com/v/{$video_id|wash}&hl=en&fs=1&rel=0&color1=0x666666&color2=0xf15e22" />
</object>
</div>
moving from actionscript (flex) to titanium and I'm experimenting with the xml markup. What I have is a template that I picked up from the doc
<ItemTemplate name="template">
<ImageView left="0" bindId="pic" id="icon" />
<Label bindId="info" id="title"/>
</ItemTemplate>
</Templates>
my question is if someone clicks on the pic or a listitem itself, how does one handle the events. through xml markup? Then how do you reference any of the control wrap in the template?
I have tried
<ImageView left="0" bindId="pic" id="icon" onclick="doClick()" />
function doClick(e) {
alert($.info.text);
}
This just produces a error and I still would not know what pic was clicked.
any help would be great..
thanks Mike
Have you checked out the Alloy Quick Start? I think many of your questions can be answered there.
Anyway, for ListViews, you cant add an event listener to an item in the template, its just a template not an actual thing on the screen (yet), refer here, and look at the alloy section.
Instead you need the itemclick event listener on the ListView itself. Check , below for a simple example of what the XML markup looks like.
<ListView id="listView" defaultItemTemplate="template" onitemclick="yourEvent" >
<!-- The Templates tag sets the ListView's templates property -->
<Templates>
<!-- Define your item templates within the Templates tags or use the
Require tag to include a view that only contains an ItemTemplate -->
<ItemTemplate name="template">
<ImageView bindId="pic" id="icon" />
<Label bindId="info" id="title" />
<Label bindId="es_info" id="subtitle" />
</ItemTemplate>
</Templates>
<ListSection headerTitle="Fruit / Frutas">
<!-- You can specify any ListItem or ListDataItem properties in ListItem -->
<!-- Specify data to bind to the item template with inline attributes
defined as <bindId>:<Ti.UI.Component.property> -->
<ListItem info:text="Apple" es_info:text="Manzana" pic:image="/apple.png" />
<ListItem info:text="Banana" es_info:text="Banana" pic:image="/banana.png" />
</ListSection>
</ListView>
Also, you need any JavaScript to be in the controller files, not in the XML markup files. *.js has javascript that is behind the view, which is *.xml.
I am trying to include an xhtml which is on another domain (on the same server) inside my .xhtml.
The sample code is the following
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<h:outputStylesheet library="css" name="style.css" target="body" />
</h:head>
<h:body>
<p:layout id="page" fullPage="true">
<!-- North -->
<p:layoutUnit position="north" size="10%"
style="border: none !important">
</p:layoutUnit>
<!-- South -->
<p:layoutUnit position="south" size="5%" collapsible="true" gutter="0">
<h:outputText value="South unit Content." />
</p:layoutUnit>
<!-- West -->
<p:layoutUnit position="west" size="200" header="Menu"
collapsible="true" effect="slide" styleClass="menuBar">
<h:form id="form1">
<p:panelMenu>
<p:submenu label="Students">
<p:menuitem value="page1" update=":centerpanel"
actionListener="#{layoutController.setNavigation('page2.xhtml')}" />
<p:menuitem value="page2" update=":centerpanel"
actionListener="#{layoutController.setNavigation('http://localhost:8080/externalsite/newpage.xhtml')}" />
</p:submenu>
</p:panelMenu>
</h:form>
</p:layoutUnit>
<!-- Center -->
<p:layoutUnit id="center" position="center">
<h:panelGroup id="centerpanel" layout="block">
<ui:include id="include" src="#{layoutController.navigation}" />
</h:panelGroup>
</p:layoutUnit>
</p:layout>
</h:body>
</html>
So basically in the center layout unit I am trying to include the external .xhtml (which is on the same domain however).
JSF templates can be included only, if they are available within the same classloader.
If you want to embed an external page into your page, you need to user iframe.
For example:
<iframe src="http://www.primefaces.org/showcase/ui/home.jsf"/>
allows you to embed PrimeFaces showcase withing your page.
This is not possible. With the ui:include Tag you can only include Code Snippets from other xhtml files. What you are trying to do is accessing Code from another domain, but what you see in the final web app is only the generated HTML and Javascript Code. You cannot work with that in your application, as you have no access to the sourcecode.