|
-
Jun 16th, 2006, 06:34 PM
#1
Thread Starter
PowerPoster
networkstream and media
this is a toughy
I want to know if I can open up a file (say, abc.avi), read until EOF, and transmit bytes[] until EOF over networkstream?
now, the tricky part is this
on the recieving end, how can I then view the data recieved, so if the transmitted data was an audio/video - it would display this (play it) to the screen.
can it be done? how? I guess I need to decode the data and show the data recieved to the user but no idea how exactly.
anyone?
-
Jun 17th, 2006, 10:08 AM
#2
Re: networkstream and media
You can send file info before transmission starts, this way the client app will be able to determine how to run it when it's done
Code:
byte[] b=new byte[1000];
FileStream fs=File.OpenRead("FilePath");
FileInfo info=new FileInfo("FilePath");
//send info object
//Wait for acceptance, then:-
while(fs.Position<fs.Length)
{
fs.Read(b,fs.Position,1000);
//Send the byte array
}
Last edited by ComputerJy; Jun 17th, 2006 at 10:10 AM.
Reason: reformatting code
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Jun 17th, 2006, 10:33 AM
#3
Thread Starter
PowerPoster
Re: networkstream and media
well yeh I know how to do that already but the tricky part is when we are recieving data, how to actually construct the data and play it back to the user
-
Jun 18th, 2006, 08:32 AM
#4
Re: networkstream and media
It's not that simple. You cannot automatically assume that the user has the class libraries required to play the media. Your best bet is to save the file to the user's computer and then execute it. If the user has the application to play it, it will play. If he doesn't, then... nothing.
-
Jun 18th, 2006, 09:07 AM
#5
Thread Starter
PowerPoster
Re: networkstream and media
yeh i know but that is not an option.
-
Jun 18th, 2006, 12:49 PM
#6
Re: networkstream and media
Well you'll need a shedload of bandwidth for a start. Also you have to realise that some media formats require you to have the entire file before you start.
I don't live here any more.
-
Jun 18th, 2006, 01:00 PM
#7
Thread Starter
PowerPoster
Re: networkstream and media
yeh i realize that however I am not talking about broadcasting it to the internet, i am talking about local network (LAN) inside your house/network.
-
Jun 20th, 2006, 05:55 AM
#8
Re: networkstream and media
Let me elaborate wossy's point.
If it's an ASX for example, it can be streamed. You'd stream it to a windows media player instance on the user's end machine. But as for WMVs, AVIs, MOVs, they play in an application such as a browser by first beginning the download of the file and the plugin or application itself handles the 'streaming'.
If you can access class libraries for the applications for each respective file type and then get them to play it by outputting a stream of audio, then you might have a chance.
So you'll need to find out about all the class libraries for each media type you want to play.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|