none
How to play incomplete media file RRS feed

  • Question

  • Hi,

    I'm using BinaryWriter to write a video/audio to disk and want to play the file while it's being written. I have checked that the completed file is working. WMP doesn't seem to want to open it until it final.

    This is what i'm doing.

    fs = new FileStream(@"D:\\tst.avi", FileMode.CreateNew, FileAccess.Write, FileShare.Read);

     

     

     

    bw = new BinaryWriter(fs);

    I've tried waiting for some time but still no luck.

    Any help would be great.


    new to .net and c#
    Sunday, November 29, 2009 6:35 AM

Answers

  • I am not sure how this is employed with a media file on disk, however, or how you would hook it up to Windows Media Player. The norm, for player, is to buffer from a web source and play once buffered, so the search would be on buffering in Windows Media. This will involve some form of stream object. When you are talking an object saved to disk, however, it may lock the file down a bit as it is being written, meaning you have to buffer and then "split" the stream to two end points (one being Media Player). That is where I would start googling.

    Hope this helps.

    Peace and Grace,
    Gregory A. Beamer (MVP)
    Think outside the box
    • Marked as answer by liurong luo Tuesday, December 1, 2009 12:23 PM
    Monday, November 30, 2009 5:34 PM
  • You need to buffer the stream and play it in Windows media player. You can pass the file location.

    Please use the following search query for further information

    http://www.google.co.in/search?q=streaming+video+%2B+windows+media+player+%2B+C%23
    Thanks,
    A.m.a.L
    Dot Net Goodies
    Don't hate the hacker, hate the code
    • Marked as answer by liurong luo Tuesday, December 1, 2009 12:23 PM
    Monday, November 30, 2009 6:26 PM
  • lol, drewdb I'm just messin with you.  Help us help you and we can all be friends and hold hands and stuff.  Since you didn't mention File Streaming/protocols or anything but a binary stream I had to assume you overlooked this issue.  Certain file formats are friendly to streaming (MPEG-TS).  Others, like AVI aint.  So you gotto stream um. 

    Basically, it all boils down to having atomic playable units of data or Packets.  If the file format isn't "packetized" then it won't stream unless you wrap it up with a diaper like file streaming service.

    File Streaming servers like Windows Media Services 9 support limited file formats.  AVI appears to be particularly difficult to translate and I was unable to find an immediate solution, but bing/google "avi streaming" and you'll get plenty of results.

    Thats what I meant O.o
    (//.T) Former member of Emo
    • Marked as answer by liurong luo Tuesday, December 1, 2009 12:23 PM
    Monday, November 30, 2009 8:23 PM

All replies

  • I am not sure how this is employed with a media file on disk, however, or how you would hook it up to Windows Media Player. The norm, for player, is to buffer from a web source and play once buffered, so the search would be on buffering in Windows Media. This will involve some form of stream object. When you are talking an object saved to disk, however, it may lock the file down a bit as it is being written, meaning you have to buffer and then "split" the stream to two end points (one being Media Player). That is where I would start googling.

    Hope this helps.

    Peace and Grace,
    Gregory A. Beamer (MVP)
    Think outside the box
    • Marked as answer by liurong luo Tuesday, December 1, 2009 12:23 PM
    Monday, November 30, 2009 5:34 PM
  • You need to buffer the stream and play it in Windows media player. You can pass the file location.

    Please use the following search query for further information

    http://www.google.co.in/search?q=streaming+video+%2B+windows+media+player+%2B+C%23
    Thanks,
    A.m.a.L
    Dot Net Goodies
    Don't hate the hacker, hate the code
    • Marked as answer by liurong luo Tuesday, December 1, 2009 12:23 PM
    Monday, November 30, 2009 6:26 PM
  • :::::SCREECH::::CRASH::::::  Take a moment to ask yourself why people went through all the trouble of creating expensive File Streaming services when they could have just picked up a partial binary and slap it into WMP/Quicktime/pick your player.  Oh wait, cause you CANT!  Next, ask yourself whether you want to create your own file streaming service or buy one then click "Mark as Answer".
    Good coding involves knowing one's logical limits and expanding them as necessary.
    Monday, November 30, 2009 7:25 PM
  • Thanks for your answers.

    What i meant by "I've waited some time" is that i've allow some to buffer first.

    P.Brian.Mackey - what in my question seems to get you heart rate going? I thought these forums were for people to learn.

    VLC Player can play partial files and was wondering what i need to do to get this happening in C# perhaps with WMP.
    new to .net and c#
    • Marked as answer by liurong luo Tuesday, December 1, 2009 12:23 PM
    • Unmarked as answer by liurong luo Tuesday, December 1, 2009 12:23 PM
    Monday, November 30, 2009 8:16 PM
  • lol, drewdb I'm just messin with you.  Help us help you and we can all be friends and hold hands and stuff.  Since you didn't mention File Streaming/protocols or anything but a binary stream I had to assume you overlooked this issue.  Certain file formats are friendly to streaming (MPEG-TS).  Others, like AVI aint.  So you gotto stream um. 

    Basically, it all boils down to having atomic playable units of data or Packets.  If the file format isn't "packetized" then it won't stream unless you wrap it up with a diaper like file streaming service.

    File Streaming servers like Windows Media Services 9 support limited file formats.  AVI appears to be particularly difficult to translate and I was unable to find an immediate solution, but bing/google "avi streaming" and you'll get plenty of results.

    Thats what I meant O.o
    (//.T) Former member of Emo
    • Marked as answer by liurong luo Tuesday, December 1, 2009 12:23 PM
    Monday, November 30, 2009 8:23 PM
  • Thanks P.Brian.Mackey. It was first thing in the morning for me and caught me off guard. I guess it's my naivity. I just assumed that streamers like VLC actually streamed the avi's but it looks like they do a lot more to do that.

    I'll have to read up a bit more on diaper like file streaming services :)

    In the last six months i have tried so many different ways to stream a media file i've lost count.

    Thanks again.
    new to .net and c#
    Monday, November 30, 2009 9:32 PM