streaming an object to the browser

Discussion in 'ASP .Net' started by =?Utf-8?B?a2FwaWxw?=, Mar 29, 2006.

  1. hi,

    i am doing a proof of concept and trying to stream 2 objects to the browser
    one is a pdf and another is a .3g2 video file. when i try to do the pdf it
    works great and the pdf opens in the browser but when i do the video file it
    just returns the gibrish from the byte[]. the vodeo is fine because when i
    link to the video directly then quicktime opens in the browser and it starts
    to play.

    I checked anyway and the 3g2 extension is on the machine and associated with
    quicktime.

    i just cant understand why the browser dosent start the video then i stream
    it. any ideas????

    check out the code.

    FileStream fs = new FileStream(@"c:\website1\test.3g2", FileMode.Open);
    //FileStream fs = new FileStream(@"c:\website1\test.pdf", FileMode.Open);
    byte[] b = new byte[fs.Length];
    fs.Read(b, 0, (int)fs.Length);
    fs.Close();
    fs.Dispose();
    Response.ContentType = "video/3g2";
    //Response.ContentType = "text/pdf";
    Response.BinaryWrite(b);
    =?Utf-8?B?a2FwaWxw?=, Mar 29, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?a2FwaWxw?=

    slagomite Guest

    did you try any of these content types?

    video/3gpp
    video/3gpp-tt
    video/3gpp2

    or maybe

    video/quicktime

    HTH
    Luke
    slagomite, Mar 29, 2006
    #2
    1. Advertising

  3. I have tried all except video/quicktime. Just tried that and it also returns
    gibrish. Any other ideas?
    =?Utf-8?B?a2FwaWxw?=, Mar 29, 2006
    #3
  4. in addition i tried to do this with a .mov(video/quicktime) file and a
    ..wmv(video/x-ms-wmv) file. i get the same gibrish.

    agian it works when you link to the file for video but the streaming works
    for a pdf.

    if it works for the pdf, why not the video, its the same concept.

    does this mean you can stream certian objects in .net???
    =?Utf-8?B?a2FwaWxw?=, Mar 30, 2006
    #4
  5. GOT IT!

    had to add
    Response.Flush();

    after
    Response.BinaryWrite(b);

    just incase anyone encounters this.
    =?Utf-8?B?a2FwaWxw?=, Mar 30, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hans Kesting

    Re: Streaming PDF to Browser from Server

    Hans Kesting, Jan 9, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    380
    Hans Kesting
    Jan 9, 2004
  2. Jerry Boone

    Re: Streaming PDF to Browser from Server

    Jerry Boone, Jan 9, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    2,000
    Jerry Boone
    Jan 9, 2004
  3. =?Utf-8?B?UnVkeSBEZWl0cmljaw==?=

    Streaming Word to browser on SSL supresses header and footer

    =?Utf-8?B?UnVkeSBEZWl0cmljaw==?=, Dec 2, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    343
    =?Utf-8?B?UnVkeSBEZWl0cmljaw==?=
    Dec 2, 2004
  4. =?Utf-8?B?UmFqYQ==?=

    Streaming response to browser

    =?Utf-8?B?UmFqYQ==?=, Jan 13, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    382
    Kevin Spencer
    Jan 13, 2005
  5. =?Utf-8?B?RGF2aWQgUmV5bm9sZHM=?=

    Example of streaming Excel to browser for download

    =?Utf-8?B?RGF2aWQgUmV5bm9sZHM=?=, Jan 17, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    7,469
    William F. Robertson, Jr.
    Jan 18, 2005
Loading...

Share This Page