Hi,
I want to store video name in database and videos in one folder.This can be achieved by fileupload.
How to retrieve videos from database and display on windows media player depending upon the query?

Recommended Answers

All 24 Replies

  1. Retrive name and video location from database
  2. Prefix video file location string with rest of the path
  3. Pass this new generated string path to media player
commented: Good plan. Wanted to reply myself but couldn't think of a good response! +2

Please explain how to pass these details to media player.

Here is nice tutorial how to do it in ASP.NET with C# or this one in regards of Silverlight
However with Silverlight you getting in trouble as not everyone has it, I'm one of them as I believe that is useless, just attempt to bit Adobe and the Flash (but that is just me)

Firstly upload the video file to a folder in the server by :

if (flUpload.PostedFile.ContentLength > 0)
{
    String strPath = Server.MapPath("../") + "UploadedFiles/Folder";
    flUpload.PostedFile.SaveAs(strPath + "/" +  this.flUploadBrief.FileName.ToString());
}

where <asp:FileUpload runat="server" ID="flUploadBrief" /> is the FileUpload Control.

And save the name of the File in database.

Then u can view the video by : <embed src="video.avi" />

Hi,
If i give src="video.avi" its load only that video.But I want to play video from database.. Video name in DB video in folder.How to give src="..." This is my problem now.Upload k.

This is the Object tag.

<OBJECT id=mPlayer height=250 width=320 classid=CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95 VIEWASTEXT>
<PARAM NAME="filename" VALUE="moviepreview/<%Response.Write(Request.QueryString.Get("id"));%>">

You have to fill the value from server side code.

<param name='fileName' value="../videos/<%#(Request.QueryString["VID"])%>">

I tried this but its working only one paritcular link only once.Its not working for all queries.

.I have 2 pages X and Y. I click the gridview hyperlink in X page it goes to Y page.In X page datanavigateurl field are specified.query string is empty for all other link.thats the problem.

I solved that problem.I did some mistake in querystring.

I have one more problem regarding this.
I have 2 pages X and Y. I click the gridview hyperlink in X page it goes to Y page.In X page datanavigateurl field are specified.I want to pass only id of the video.In that Y page i want to do some server side code in source code(html) .coz there is some conditions to retrieve videoname.So i want to process and result will be assign to one variable that variable will be assign to media player.Help me!

i have some problem in media player.because all videos are working perfectly in my system.But in other system one of my mpeg video didnt play in that player.I am using above <object> codings.i am checking more than 5 systems.but didnt play .whats problem here?Help me.How to solve that problem?Any version problem?

Actually the video can be played in the player you select in your object tag code.It can be Media Player,Real Player,Google Video Player depending on the player available to your client machine. Here i suspect the other machines doesn't have the required Active X. No problem, with your Object please add a Embed Tag with same parameters. The embedded player will play in all machines.

The format is as below. Please change the parameters as per ur requirements.

<object width="320" height="290" 
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" 
id="mediaplayer1"><param name="Filename" value="kids.mpg"><param name="AutoStart" value="True"><param name="ShowControls" value="True"><param name="ShowStatusBar" value="False"><param name="ShowDisplay" value="False"><param name="AutoRewind" value="True"><embed type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"
width="320" height="290" src="/support/dreamweaver/ts/documents/kids.mpg"
filename="kids.mpg" autostart="True" 
showcontrols="True" showstatusbar="False" 
showdisplay="False" autorewind="True"></embed></object>

Please let me know if it works.

In embed tag you specify src and file name.Both are same or not.
I used ur solution.It also doesnt play video.But controls are working that means play mode changed to stop mode.Video doesnt display.Please solve this!

Put the absolute filepath in the src and param tags and filename in the filename tag. I think u r having path problems. Just do some R&D. Put the video in the current folder and change all the 3 values same :]

<param name="Filename" value="kids.mpg">
src="kids.mpg"
filename="kids.mpg"

If it works then carry on with ur proceedings.

Do let me know if it works.

I am using some sample mpeg fies which is download from net.One of the video is perfectly working in all client machine.someone is not working.whats the reason for this.I am using .net 2005.There some of the embed tags attributs are not valid
autostart="True" showcontrols="True" showstatusbar="False" showdisplay="False" autorewind="True".just it gives error msg.it doesn affect anything.

Just i am playing mpg file in media player without using program.it gives this error msg
"Windows Media Player cannot play the file. The Player might not support the file type or a required codec might not be installed on your computer."
now i am using the original video which one i want to use in website.If this file is working in media player its also working in pgm.How to solve this problem?

Oh then it is the problem of the media file, no issues. No problem for the program. Collect some original media files and test on them. And if the no codec error comes , then the user should install required files from site, that is ok , no problems with that , it gives in all video websites that one should install the required pluggins.
I think u have done ur part.

How can i give that msg?and also How to provide the details for download in site.little bit confused here.I saw that msg in lot of sites.
I am using video cam to take videos after that i am using that video in site.please explain?

No no you don't have to do anything for that, if the system doesn't find the required activex controls it will automatically direct to the activex provider site . U just look whethear the video plays in those systems where the activex are there.
I would like to know if the mpeg,avi files are now running in ur webpage:S

Just i upload only one sample page with <object> tag details in site.site is perfectly ok in my sys.In other machine i tried that site.It gives blank media player.it doesnt give any msg like u said.what to do?
But wmv avi files are working perfectly in all client machine.mpeg files only problem.Videocam output format mpeg.Any conversion need here?

Is there any other way to play mpeg files.Please clarify all these things.Its very urgent.

I think the format is mpeg-2 or mpeg-4. mpeg-1 is supported in media player. Do some searching in google for mpeg-2 supported player. Accordingly download the codecs.

Hi sebastian,
I found codec for mpeg-2.Combination of two codecs are perfectly working.just installed in client machine and check with media player and also program.Two codecs are
k_lite_Codec and stinky_mpeg_2_codec from www.free-codecs.com.
Now my problem is, How to use that codecs in my pgm.I give instructions and link to that two codecs.Is it correct.Any other choice to bind with pgm.please suggest.

No it is not a good idea to make the user download codecs, he/she would be dazzled.
You can do one thing search for some other players other than media player such as Real,Quicktime player,this are also widley used for playing videos in web.
Do some searching n tell me the results. Actually i m a bit busy otherwise i could be available for some R&D.

i am trying with quicktime player.There is also same problem.it doesnt play the mpeg files.

<object width="160" height="144"
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab">
<param name="src" value="sample.mov">
<param name="autoplay" value="true">
<param name="controller" value="false"><embed src="sample.mov" width="160" height="144"
   pluginspage="http://www.apple.com/quicktime/download/">
</embed></object>

I am using above code.Play mpeg files instead of mov.
if i am using quicktime,At the run time,Before video page it gives options for install software and move to download that player dont install means it moves to video page.it doesnt play the mpeg files in some of the sys.I dont know what to do?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.