How to add audio to a Django based webpage?

29 views
Skip to first unread message

Homer

unread,
Apr 4, 2012, 3:50:38 PM4/4/12
to django...@googlegroups.com
I tried to use <object> command in my templates directly, but it seems it is not working... Here is my code:
{% for item in ShowAudio %}
<objectheight="25%"width="25%"classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
<param name="ClickToPlay" value="1" />
<param name="FileName" value="{{ media_url }}/media/audios/baoxiangui.m4a" />
</object>
{% endfor %}

Should I add something else so that it would work? Thanks for your help!

Joel Goldstick

unread,
Apr 4, 2012, 5:54:58 PM4/4/12
to django...@googlegroups.com
On Wed, Apr 4, 2012 at 3:50 PM, Homer <hi...@foxmail.com> wrote:
> I tried to use <object> command in my templates directly, but it seems it is
> not working... Here is my code:
> {% for item in ShowAudio %}
> <objectheight="25%"width="25%"classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">

shouldn't this be:
> <object height="25%"width="25%"classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
It looks like you have no space after the object tag before the height attribute

> <param name="ClickToPlay" value="1" />
> <param name="FileName" value="{{ media_url }}/media/audios/baoxiangui.m4a"
> />
> </object>
> {% endfor %}
>
> Should I add something else so that it would work? Thanks for your help!
>

> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/YGBeVMertYYJ.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

--
Joel Goldstick

Andy McKay

unread,
Apr 4, 2012, 9:05:07 PM4/4/12
to django...@googlegroups.com
On Wed, Apr 4, 2012 at 12:50 PM, Homer <hi...@foxmail.com> wrote:

> Should I add something else so that it would work? Thanks for your help!

There's nothing I've seen yet that's a Django problem. Does the
outputted HTML look right? Does that work? If not tell us and we'll
see if we can help you figure out how your Django templating isn't
outputting the right value.

I'll also recommend the HTML audio tag.

Homer

unread,
Apr 5, 2012, 11:12:00 PM4/5/12
to django...@googlegroups.com
You are right... I fixed that and the webpage can play the audio automatically. But I want to play it when I click it. By the way, on my webpage, the area of Windows Media Player is just a blank... I do not know why. But if I right click it, I can see the menu of Windows Media Player.

在 2012年4月4日星期三UTC-4下午5时54分58秒,Joel Goldstick写道:
On Wed, Apr 4, 2012 at 3:50 PM, Homer <hi...@foxmail.com> wrote:
> I tried to use <object> command in my templates directly, but it seems it is
> not working... Here is my code:
> {% for item in ShowAudio %}
> <objectheight="25%"width="25%"classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">

shouldn't this be:
> <object height="25%"width="25%"classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
It looks like you have no space after the object tag before the height attribute

> <param name="ClickToPlay" value="1" />
> <param name="FileName" value="{{ media_url }}/media/audios/baoxiangui.m4a"
> />
> </object>
> {% endfor %}
>
> Should I add something else so that it would work? Thanks for your help!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/YGBeVMertYYJ.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to

> django-users+unsubscribe@googlegroups.com.


> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

--
Joel Goldstick

Homer

unread,
Apr 5, 2012, 11:14:26 PM4/5/12
to django...@googlegroups.com
It played the audio automatically after I fixed the stupid space error... However, the area for Windows Media Player (WMP) is still a blank. If I right click it, I can see the menu of WMP.... And I want to play it when I click it but I cannot... That is the situation right now.

在 2012年4月4日星期三UTC-4下午9时05分07秒,Andy McKay写道:
Reply all
Reply to author
Forward
0 new messages