473,399 Members | 3,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Allow browser streaming of multimedia files

Hello,

I'm looking for a way to allow a client who clicks on a link the ability to
"adodb.stream" a multimedia file (mainly audio/wav) files, but the file they
would be accessing is outside the wwwroot (for security / traceability). I
don't want the "save as" box to open for streamable content. Basically I'm
trying to mimic the exact action, as if they had clicked a
www.mydomain.com/download.wav file, and allow the browser to open it up
automatically and save it if needed.

Here is the code I'm currently using to stream the audio file to the client.

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile "c:\outside_my_wwwroot\test.wav"
Response.ContentType = "audio/wav"
Response.BinaryWrite objStream.Read()
objStream.Close

I'm sure it can be done, I really just probably need the appropriate headers
to tag to page (I'm using the adodb.stream object ).

Can anyone help me out with this?

Thanks!
--Michael
Jul 19 '05 #1
1 3489
I've figured it out, for those ever interested, you need to do this.

Response.AddHeader "Content-Disposition", "inline; filename=anyfilename.wav"

key is in the "inline" not "attachment", If you want to force a "save as"
box, you just have to use attachment. You'll also need to set up the
ContentType, as so

strFileType = lcase(Right(strFileName, 4))

Select Case strFileType
Case ".asf"
ContentType = "video/x-ms-asf"
Case ".avi"
ContentType = "video/avi"
Case ".doc"
ContentType = "application/msword"
Case ".zip"
ContentType = "application/zip"
Case ".xls"
ContentType = "application/vnd.ms-excel"
Case ".gif"
ContentType = "image/gif"
Case ".jpg", "jpeg"
ContentType = "image/jpeg"
Case ".wav"
ContentType = "audio/wav"
Case ".mp3"
ContentType = "audio/mpeg3"
Case ".mpg", "mpeg"
ContentType = "video/mpeg"
Case ".pdf"
ContentType = "application/pdf"
Case ".rtf"
ContentType = "application/rtf"
Case ".htm", "html"
ContentType = "text/html"
Case ".asp"
ContentType = "text/asp"
Case Else
'Handle All Other Files
ContentType = "application/octet-stream"
End Select

Response.ContentType = ContentType

"Michael" <raterus@localhost> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hello,

I'm looking for a way to allow a client who clicks on a link the ability to "adodb.stream" a multimedia file (mainly audio/wav) files, but the file they would be accessing is outside the wwwroot (for security / traceability). I don't want the "save as" box to open for streamable content. Basically I'm trying to mimic the exact action, as if they had clicked a
www.mydomain.com/download.wav file, and allow the browser to open it up
automatically and save it if needed.

Here is the code I'm currently using to stream the audio file to the client.
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile "c:\outside_my_wwwroot\test.wav"
Response.ContentType = "audio/wav"
Response.BinaryWrite objStream.Read()
objStream.Close

I'm sure it can be done, I really just probably need the appropriate headers to tag to page (I'm using the adodb.stream object ).

Can anyone help me out with this?

Thanks!
--Michael

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Average_Joe | last post by:
Hello Java people, Been awhile since I've used Java, and when I did, it was pretty much XML stuff. Anyhow, I've got a client who needs to provide web viewers with both streaming (live) video...
1
by: JC | last post by:
Hi, I have to play a streaming audio. So in a thread I play audio as follow thread{ //some code for(;;){ //some code waveOutPrepareHeader(hwo, &(whdr), sizeof(WAVEHDR)); waveOutWrite(hwo,...
3
by: Rob | last post by:
I have an ASP.Net web app that generates a Crystal Report in PDF format. Since there is sensitive data within the reports, the pdfs need to be streamed to the browser then deleted immediately. The...
1
by: adiela | last post by:
hello everyone..i would like to ask something regarding my project.. i've been planning to develop a website using asp code for streaming multimedia features...unfortunatly...i have zero...
4
by: Gary Brown | last post by:
Hi, I need a web browser capable of handling video streams and that will stay in front of the Z order. There are a number of video streaming sources I watch that launch a browser window...
2
by: Changhao | last post by:
Hi, friends, I am implementing a protocol on top of 'asyncore.dispatcher' to send streaming multimedia data over TCP socket. However, I found that the throughput of my current implementation is...
0
by: namrataa | last post by:
Hi, I am doing a client-server based multimedia player in VS2008 using WCF & WPF C#. I have used mediaelement for the player. Now my problem is that when a user selects a particular song to the...
2
by: Alberto corrales | last post by:
Hi! I am working with a video source that provides RGB frames (24 bits per pixel) and I need to create a video server to send on wifi to a client application. The problem is that there are too...
2
pradeepjain
by: pradeepjain | last post by:
i have a small doubt i dont know if ques is proper or not sorry. I have got a call for job for this company http://www.telecascade.com/ Thye told job will be related to multimedia and video...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.