Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

Windows Media Player - dynamic source from db

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
chisholmd
Asked:
chisholmd
  • 3
1 Solution
 
sybeCommented:
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
 
chisholmdAuthor Commented:
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
 
chisholmdAuthor Commented:
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
 
chisholmdAuthor Commented:
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now