?
Solved

Windows Media Player - dynamic source from db

Posted on 2003-03-08
4
Medium Priority
?
236 Views
Last Modified: 2007-12-19
Hi,  With graphics I have done this:
<img src=<%=some.asp%>>
The some asp page sets its response.ContentType = "image/jpg" or whatever.  This works fine.  

What I want to do is the same thing but with the windows media player control.  From what I have seen there are two parameters 'properties' :

FileName
URL

<PARAM NAME="FileName" VALUE="some.asf"> works fine...however

<PARAM NAME="FileName" VALUE="some.asp"> does not even though I have set the ContentType to "video/x-ms-asf"

Is there some reason why this will not work??

here is the relevent code from my "some.asp"
        Response.contenttype = "video/x-ms-asf"
     Response.binarywrite rs.fields(0)

The player page includes:
<OBJECT ID="MediaPlayer"  
            classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"  
            <PARAM NAME="FileName" VALUE="some.asp?uid=5">
</OBJECT>

Any done this before?

dave
0
Comment
Question by:chisholmd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 28

Accepted Solution

by:
sybe earned 400 total points
ID: 8097044
Does the "some.asp" have code in which you check Session variables ?? Because mediaplayer will not pass the Session variables from the browser.

It might help to use:

<img dynasrc="<%=some.asp%>">

it will work on most multimedia content.
0
 
LVL 7

Author Comment

by:chisholmd
ID: 8098062
Initially, Yes I was using a session variable in the some asp to know which record to pull from the db to retrieve the ASF stream.  However I removed it in my testing adn just hardcoded it to retrieve a specific record and it still didn't work.  

The structure of the some.asp is bassically this
...buffer=true...
...set up connection object...
...format sql string...
...retrieve recordset of one field...
...change content type to  "video/x-ms-asf"
...do a Response.binarywrite rs.fields(0)...

(The ASF's in question are only about 25kb, these are not massive videos or anything, They only contain audio.)

I tested the connection object and record retreival and I know I am getting the record back. I also confirmed that the field is populated with the ASF. (Its in a IMAGE field I don't know yet if it retained it's integrity until I can get it out and play it. My next test will be just to write it back out to a file and see if it plays.)

I woke up this morning and my first thought was "stream object" perhaps I have to 'convert?' it to a stream object of some sort instead of doing a binary write???

My last resort will be to simply save the ASF to disk on upload, with a name containing the appropriate record ids but this is the least elegent solution for me.

I'll try <img dynasrc="<%=some.asp%>"> but will that play  an audio ASF ?? Guess I'll find out. :)

cheers,
dave

0
 
LVL 7

Author Comment

by:chisholmd
ID: 8098495
w00t!!!  Thanks sybe, the <img dynsrc=''> worked very well.

I am able to re-source it by pointing to my .asp including my query strings. e.g.

function playit(vWhich){
     player.dynsrc= 'some.asp?uid=<%=uid%>&which='+vWhich
}

<img id=player dynsrc=''>

So on a given page I might have 3 sound files per 'question record'  I can trigger which to play based on the parameter passed.  
e.g.
onClick=playit('question')
or
onClick=playit('answer')

1 function
1 asp page
1 happy coder :)

Now I have to test in NS6/7 :(

Thanks again,
dave

0
 
LVL 7

Author Comment

by:chisholmd
ID: 8098499
I know it might not be the most efficient thing to save my ASF's in my SQL Server but now that I can all my content is in the database which help my stay organized and allows my to reuse it from other sources VB App's for example.

thanks again

 
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question