Wrox Programmer Forums
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 18th, 2003, 06:29 AM
Registered User
 
Join Date: Oct 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default XHTML

Hi

We could able to preview a ringtone using <a href ="ringer.wav">Preview</a> in XHTML

How to download a ringtone using XHTML,any body is having solution for this.Kindly revert back.

Thanks in Advance.

B.Rajesh.
 
Old October 19th, 2003, 05:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Moharo
Default

i don't think you should reference an anchor to that file, rather use an application like media player to open it...

the genuine genius
 
Old October 19th, 2003, 11:43 PM
Registered User
 
Join Date: Oct 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Moharo
 i don't think you should reference an anchor to that file, rather use an application like media player to open it...

the genuine genius
Yes in XHTML we can use anchor tag [<a href="">] to preview that wave/midi file but i need to download that file into client machine.our original wave/midi file reside into server machine.

If u have any suggestions? pl. revert me.

Thanks,
Rajpalan
 
Old October 20th, 2003, 12:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Tell them to right-click and save target as if you don't think they know already. They will thank you for teaching them something useful too. :)

Compress (zip) the file.

Force download by changing the MIME type. Not recommended.
http://www.htmlhelp.com/faq/html/med...force-download

(o<
//\ =^..^=
 
Old October 20th, 2003, 01:48 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

You could also use an embedded media player, such as Windows Media or Real One. The set up is not very difficult and the software used to create the media files is free to download, the windows media encoder can be found at http://windowsmedia.microsoft.com and the Real Producer package can be found at http://www.real.com. You'll probably have to do a bit of searching to find the free version of the product on real.com they seem to make it harder to find with each new release. The software has those nifty wizards built in to create a webpage embedded player, which you could look at the source code and find methods of customizing the embedded player to your needs.

The sound quality is greatly increased with these formats as well.

Here is an example of an embedded real one player which when ran in a browser will play a song file from my website.

Code:
<object id='video1' classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' style='height: 125px; width: 275px'>
    <param name='controls' value='All' />
    <param name='console' value='Clip1' />
    <param name='autostart' value='false' />
    <param name='src' value='http://www.smilingsouls.net/web_music/david_morgan/medley.rm' />
    <embed src='http://www.smilingsouls.net/web_music/david_morgan/medley.rm' type='audio/x-pn-realaudio-plugin' console='Clip1' controls='All' style='height: 125px; width: 275px;' autostart='false' />
</object>
The size of the embedded player can, of course, be changed. And I beleive that you can also embed a .wav directly using the same technique.

At its simpliest it would look like:
<embed src='file.wav' style='width: 200px; height: 50px;' />

I have no idea if any of this is proprietary to a particular browser but I know it works.

I do know that the first example runs in either Mozilla or IE.

Best of luck!
: )
Rich



:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old October 20th, 2003, 02:03 AM
Registered User
 
Join Date: Oct 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks to all.

In WML we have "proxy:download?source=http://servername:8080/myfolder/myringer.wav" using this we are able to download this 'myringer.wav' file from server to client machine.
So How is possible with XHTML?I am using Openwave SDK 6.2.
Now u all understand my problem if not pl. revert me.

Thanks
 
Old October 20th, 2003, 02:10 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Correction to my previous post:
The Windows Media Encoder can be found here:
http://www.microsoft.com/downloads/d...DisplayLang=en

After doing some research I also found that Real Networks changed the name of its encoder to "Helix" producer, which can be found here:
http://www.realnetworks.com/products...cer/basic.html

And I forgot to mention another popular media player, Apple Quicktime, you're likely to have greater trouble finding a free encoder for Quicktime... I've been on that quest and failed : )

Quote:
quote:
In WML we have "proxy:download?source=http://servername:8080/myfolder/myringer.wav" using this we are able to download this 'myringer.wav' file from server to client machine.
So How is possible with XHTML?I am using Openwave SDK 6.2.
Now u all understand my problem if not pl. revert me.
The solution that I provided is XHTML compliant and will play the sound. If you simply need the user to download the file then I suggest using Anonymous FTP or the other suggestions. Otherwise the sound will open in the default media player for .wav files on the client's machine.

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old October 20th, 2003, 04:59 AM
Registered User
 
Join Date: Oct 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah that sound file plays in the default media player for .wav files on the client's
machine using anchor tag but i need to download that sound file.
In WML we have "proxy:download?source=http://servername:8080/myfolder/myringer.wav",
like in XHTML do we have any tag?or any suggestions?

Thanks
 
Old October 20th, 2003, 01:49 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

OK if you want to only download the file and prompt the client to save the file on their machine then use anonymous FTP and create an FTP link to the file using the anchor tag.

<a href='ftp://myfolder/myringer.wav'>

Anonymous FTP may or may not be available on your server but that is the best route to go and I think does what you want. You can also create an FTP user with restricted access and embed the username, password in the url for that user.

A suggestion provided earlier was to .zip the file, if a file is not considered web-related as is the case with .zip file then the protocol won't matter.

To answer your question there is no tag that will do that you need to change protocols or change the extension.

: )
Rich


:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old October 20th, 2003, 02:07 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Well, it can be done, and even over HTTP. What you need is a Server Side script that streams the wav file to the browser. The user is presented with a Save As dialog, so they can determine where the file should be saved. It's not possible to circumvent this prompt on the Internet: the browser will not allow it. In an Intranet environment, with relaxed security settings, you may have more luck.

Anyway, the next code block below is for ASP. You'll find a PHP alternative near the end.

Code:
Dim sFullFileName
sFullFileName = "C:\Test.wav"

Response.Contenttype="application/x-unknown"
Response.Addheader "Content-Disposition", "attachment; filename=" & chr(34) & sFileName & chr(34)
Response.Binarywrite GetBinaryFile(sFullFileName)

Function GetBinaryFile(ByVal sFileSpec)
         Const adTypeBinary = 1
         Dim objStream
         Set objStream = Server.Createobject("ADODB.Stream")
         objStream.Open
         objStream.Type = adTypeBinary
         objStream.LoadFromFile sFileSpec
         GetBinaryFile = objStream.read
         Set objStream = Nothing
End Function
If you put this code in it's own file and create a link to it, you'll be prompted to save the file.

The good thing about this solution is that you are not directly linking to a WAV file within the current web scope. This allows you to add some extra security checks (if necessary of course) before you actually stream the file to the browser.

If you want, you can make the page more dynamic. Instead of using a
hard-coded filename of "C:\Test.wav", you could retrieve the name from the QueryString, a Form variable or whatever suits your needs.

PHP
Code:
<?php
    header("Content-type: application/x-unknown");
    header("Content-Disposition: attachment; 
filename=proposedFileName.wav");
    readfile('test.wav');
?>
Hope this helps,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
XHTML Validation nairaby HTML Code Clinic 2 August 11th, 2007 02:45 AM
Seeing the XHTML output andyhague XSLT 1 March 23rd, 2006 02:15 PM
asp pages to xhtml BrendonMelville Ajax 1 March 14th, 2006 01:54 PM
Beginning XHTML Lynk Wrox Book Feedback 1 March 1st, 2005 11:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.