PC Review


Reply
Thread Tools Rate Thread

Cannot jump to new part of Silverlight video when using handler

 
 
Roger Martin
Guest
Posts: n/a
 
      14th Nov 2008
This is a follow-up to my post "Silverlight video doesn't work when file is
streamed from handler in ASP.net" at
http://www.microsoft.com/communities...0-5ee60d2a18a5.

I have a web site under .NET 2.0 that renders videos using the Silverlight
media player. When I stream the video file (.wmv) to the browser via a
hard-coded link to the file, all is well. And when I use an HTTP handler to
stream the video to the browser, it also plays. BUT... when I use the handler
the Silverlight player has a problem - I cannot jump to different portions of
the video by dragging the position indicator or clicking a new possition.
When I try, the center of the player turns into rotating circles and inside
it says "0". In other words, it is telling me to wait as it moves to the new
position, but it never does.

Furthermore, once I attempt to go to a new position, the Play button no
longer works and there is nothing I can do to get the video to play short of
reloading the page.

I set up two demonstration pages:
http://www.galleryserverpro.com/dev/webapp2/video2.aspx - This uses the
handler and demonstrates the issue. Notice that - for example - you cannot
move the cursor to the middle of the video and click Play.

http://www.galleryserverpro.com/dev/...nohandler.aspx - This is
identical to the first page, except instead of using the handler it
hard-codes a direct link to the .wmv file. You can jump around to different
sections without any trouble.

Using the first link above, I see the issue in these setups:

Win 2008 Server / FF3
Vista / FF3
Win XP / FF2
Win XP / IE6

Interestingly, the handler *does* work in IE7 (Win 2008 Server and Vista).

Below is the HTTP handler:

using System.IO;
using System.Web;

namespace WebApplication2.handler
{
[System.Web.Services.WebService(Namespace = "http://tempuri.org/")]
[System.Web.Services.WebServiceBinding(ConformsTo =
System.Web.Services.WsiProfiles.BasicProfile1_1)]
public class getmediaobject : IHttpHandler
{
#region IHttpHandler Members

public bool IsReusable
{
get { return true; }
}

public void ProcessRequest(HttpContext context)
{
ProcessMediaObject(context,
context.Server.MapPath("~/video/3StrikesChipmunk_56.wmv"));
}

#endregion

private void ProcessMediaObject(HttpContext context, string filePath)
{
FileStream fileStream = null;
try
{
context.Response.Clear();
context.Response.ContentType = "video/x-ms-wmv";
context.Response.Buffer = false;

HttpCachePolicy cachePolicy = context.Response.Cache;
cachePolicy.SetExpires(System.DateTime.Now.AddSeconds(2592000)); // 30
days
cachePolicy.SetCacheability(HttpCacheability.Public);
cachePolicy.SetValidUntilExpires(true);

const int bufferSize = 32768;
byte[] buffer = new byte[bufferSize];
long byteCount;
fileStream = File.OpenRead(filePath);
context.Response.AddHeader("Content-Length",
fileStream.Length.ToString());
while ((byteCount = fileStream.Read(buffer, 0, buffer.Length)) > 0)
{
if (context.Response.IsClientConnected)
{
context.Response.OutputStream.Write(buffer, 0, buffer.Length);
context.Response.Flush();
}
else
{
return;
}
}
}
finally
{
if (fileStream != null)
fileStream.Close();

context.Response.End();
}
}
}
}

Thanks for your help!
Roger Martin
Gallery Server Pro
 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      14th Nov 2008
my guess (if you would use a network sniffer as I suggested earlier
you'd know) is that silverlight use gets with a range when streaming
video (flash does). this is supported by iis, but your handler does not
support it. read the w3c http 1.1 spec to learn how to implement it.

-- bruce (sqlwork.com)

Roger Martin wrote:
> This is a follow-up to my post "Silverlight video doesn't work when file is
> streamed from handler in ASP.net" at
> http://www.microsoft.com/communities...0-5ee60d2a18a5.
>
> I have a web site under .NET 2.0 that renders videos using the Silverlight
> media player. When I stream the video file (.wmv) to the browser via a
> hard-coded link to the file, all is well. And when I use an HTTP handler to
> stream the video to the browser, it also plays. BUT... when I use the handler
> the Silverlight player has a problem - I cannot jump to different portions of
> the video by dragging the position indicator or clicking a new possition.
> When I try, the center of the player turns into rotating circles and inside
> it says "0". In other words, it is telling me to wait as it moves to the new
> position, but it never does.
>
> Furthermore, once I attempt to go to a new position, the Play button no
> longer works and there is nothing I can do to get the video to play short of
> reloading the page.
>
> I set up two demonstration pages:
> http://www.galleryserverpro.com/dev/webapp2/video2.aspx - This uses the
> handler and demonstrates the issue. Notice that - for example - you cannot
> move the cursor to the middle of the video and click Play.
>
> http://www.galleryserverpro.com/dev/...nohandler.aspx - This is
> identical to the first page, except instead of using the handler it
> hard-codes a direct link to the .wmv file. You can jump around to different
> sections without any trouble.
>
> Using the first link above, I see the issue in these setups:
>
> Win 2008 Server / FF3
> Vista / FF3
> Win XP / FF2
> Win XP / IE6
>
> Interestingly, the handler *does* work in IE7 (Win 2008 Server and Vista).
>
> Below is the HTTP handler:
>
> using System.IO;
> using System.Web;
>
> namespace WebApplication2.handler
> {
> [System.Web.Services.WebService(Namespace = "http://tempuri.org/")]
> [System.Web.Services.WebServiceBinding(ConformsTo =
> System.Web.Services.WsiProfiles.BasicProfile1_1)]
> public class getmediaobject : IHttpHandler
> {
> #region IHttpHandler Members
>
> public bool IsReusable
> {
> get { return true; }
> }
>
> public void ProcessRequest(HttpContext context)
> {
> ProcessMediaObject(context,
> context.Server.MapPath("~/video/3StrikesChipmunk_56.wmv"));
> }
>
> #endregion
>
> private void ProcessMediaObject(HttpContext context, string filePath)
> {
> FileStream fileStream = null;
> try
> {
> context.Response.Clear();
> context.Response.ContentType = "video/x-ms-wmv";
> context.Response.Buffer = false;
>
> HttpCachePolicy cachePolicy = context.Response.Cache;
> cachePolicy.SetExpires(System.DateTime.Now.AddSeconds(2592000)); // 30
> days
> cachePolicy.SetCacheability(HttpCacheability.Public);
> cachePolicy.SetValidUntilExpires(true);
>
> const int bufferSize = 32768;
> byte[] buffer = new byte[bufferSize];
> long byteCount;
> fileStream = File.OpenRead(filePath);
> context.Response.AddHeader("Content-Length",
> fileStream.Length.ToString());
> while ((byteCount = fileStream.Read(buffer, 0, buffer.Length)) > 0)
> {
> if (context.Response.IsClientConnected)
> {
> context.Response.OutputStream.Write(buffer, 0, buffer.Length);
> context.Response.Flush();
> }
> else
> {
> return;
> }
> }
> }
> finally
> {
> if (fileStream != null)
> fileStream.Close();
>
> context.Response.End();
> }
> }
> }
> }
>
> Thanks for your help!
> Roger Martin
> Gallery Server Pro

 
Reply With Quote
 
 
 
 
Allen Chen [MSFT]
Guest
Posts: n/a
 
      14th Nov 2008
Hi Roger,

I still cannot reproduce this problem on my side. As Bruce suggested, first
try to add following HTTP header in the response to see if it works:

context.Response.AddHeader("Accept-Ranges", "bytes");

Refer to Header Field Definitions:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

Please let me know if you made progress on this issue. I'll try to find a
mchine that can reproduce this issue.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| Thread-Topic: Cannot jump to new part of Silverlight video when using
handler
| thread-index: AclGCAbQg8ZDlearR8yLrR5iezrDyg==
| X-WBNR-Posting-Host: 207.46.193.207
| From: =?Utf-8?B?Um9nZXIgTWFydGlu?= <(E-Mail Removed)>
| Subject: Cannot jump to new part of Silverlight video when using handler
| Date: Thu, 13 Nov 2008 19:21:04 -0800
| Lines: 112
| Message-ID: <8F24EAA1-3E75-4BE0-952A-(E-Mail Removed)>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3168
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:79857
| NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| This is a follow-up to my post "Silverlight video doesn't work when file
is
| streamed from handler in ASP.net" at
|
http://www.microsoft.com/communities...aspx?dg=micros
oft.public.dotnet.framework.aspnet&mid=e9a38d03-83a8-41fc-8950-5ee60d2a18a5.
|
| I have a web site under .NET 2.0 that renders videos using the Silverlight
| media player. When I stream the video file (.wmv) to the browser via a
| hard-coded link to the file, all is well. And when I use an HTTP handler
to
| stream the video to the browser, it also plays. BUT... when I use the
handler
| the Silverlight player has a problem - I cannot jump to different
portions of
| the video by dragging the position indicator or clicking a new possition.
| When I try, the center of the player turns into rotating circles and
inside
| it says "0". In other words, it is telling me to wait as it moves to the
new
| position, but it never does.
|
| Furthermore, once I attempt to go to a new position, the Play button no
| longer works and there is nothing I can do to get the video to play short
of
| reloading the page.
|
| I set up two demonstration pages:
| http://www.galleryserverpro.com/dev/webapp2/video2.aspx - This uses the
| handler and demonstrates the issue. Notice that - for example - you
cannot
| move the cursor to the middle of the video and click Play.
|
| http://www.galleryserverpro.com/dev/...nohandler.aspx - This
is
| identical to the first page, except instead of using the handler it
| hard-codes a direct link to the .wmv file. You can jump around to
different
| sections without any trouble.
|
| Using the first link above, I see the issue in these setups:
|
| Win 2008 Server / FF3
| Vista / FF3
| Win XP / FF2
| Win XP / IE6
|
| Interestingly, the handler *does* work in IE7 (Win 2008 Server and Vista).
|
| Below is the HTTP handler:
|
| using System.IO;
| using System.Web;
|
| namespace WebApplication2.handler
| {
| [System.Web.Services.WebService(Namespace = "http://tempuri.org/")]
| [System.Web.Services.WebServiceBinding(ConformsTo =
| System.Web.Services.WsiProfiles.BasicProfile1_1)]
| public class getmediaobject : IHttpHandler
| {
| #region IHttpHandler Members
|
| public bool IsReusable
| {
| get { return true; }
| }
|
| public void ProcessRequest(HttpContext context)
| {
| ProcessMediaObject(context,
| context.Server.MapPath("~/video/3StrikesChipmunk_56.wmv"));
| }
|
| #endregion
|
| private void ProcessMediaObject(HttpContext context, string filePath)
| {
| FileStream fileStream = null;
| try
| {
| context.Response.Clear();
| context.Response.ContentType = "video/x-ms-wmv";
| context.Response.Buffer = false;
|
| HttpCachePolicy cachePolicy = context.Response.Cache;
| cachePolicy.SetExpires(System.DateTime.Now.AddSeconds(2592000)); //
30
| days
| cachePolicy.SetCacheability(HttpCacheability.Public);
| cachePolicy.SetValidUntilExpires(true);
|
| const int bufferSize = 32768;
| byte[] buffer = new byte[bufferSize];
| long byteCount;
| fileStream = File.OpenRead(filePath);
| context.Response.AddHeader("Content-Length",
| fileStream.Length.ToString());
| while ((byteCount = fileStream.Read(buffer, 0, buffer.Length)) > 0)
| {
| if (context.Response.IsClientConnected)
| {
| context.Response.OutputStream.Write(buffer, 0, buffer.Length);
| context.Response.Flush();
| }
| else
| {
| return;
| }
| }
| }
| finally
| {
| if (fileStream != null)
| fileStream.Close();
|
| context.Response.End();
| }
| }
| }
| }
|
| Thanks for your help!
| Roger Martin
| Gallery Server Pro
|

 
Reply With Quote
 
Roger Martin
Guest
Posts: n/a
 
      14th Nov 2008
Unfortunately, adding "Accept-Ranges" did not help; in fact, in made it
worse. When present, the video refuses to play at all, and no position
indicator appears to allow dragging or repositioning.

Here are the response headers after I added it:
Frame: Number = 434, Captured Frame Length = 1514, MediaType = ETHERNET
+ Ethernet: Etype = Internet IP
(IPv4),DestinationAddress:[00-16-E6-8F-5E-9E],SourceAddress:[00-06-25-7F-45-9D]
+ Ipv4: Src = 209.67.188.9, Dest = 192.168.1.102, Next Protocol = TCP,
Packet ID = 29397, Total IP Length = 1500
+ Tcp: Flags=...A...., SrcPort=HTTP(80), DstPort=63247, PayloadLen=1460,
Seq=3634901546 - 3634903006, Ack=233418134, Win=64240 (scale factor 0x0) =
64240
- Http: Response, HTTP/1.1, Status Code = 200, URL:
/dev/webapp2/handler/getmediaobject.ashx
ProtocolVersion: HTTP/1.1
StatusCode: 200, Ok
Reason: OK
Cache-Control: public
ContentLength: 449378
ContentType: video/x-ms-wmv
Expires: Sun, 14 Dec 2008 13:59:01 GMT
Accept-Ranges: bytes
Server: Microsoft-IIS/7.0
XAspNetVersion: 2.0.50727
XPoweredBy: ASP.NET
Date: Fri, 14 Nov 2008 13:59:00 GMT
Connection: close
HeaderEnd: CRLF
+ payload: HttpContentType = video/x-ms-wmv

It is odd you have such a hard time reproducing the issue. I have several
computers here with a total of 4 browsers (FF2, FF3, IE6, IE7) and the only
place it works is with IE7.

Roger
 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      14th Nov 2008
you actually have to add Range support to your handler, not just say you
have it and ignore the range requests. look at the request to see if
it has a range specified. a range specifies a offset and a length of
bytes to return. that is you don't stream the whole file per request,
just the bytes requested.

ie7 is probably precaching the video (maybe a bug).

-- bruce (sqlwork.com)

Roger Martin wrote:
> Unfortunately, adding "Accept-Ranges" did not help; in fact, in made it
> worse. When present, the video refuses to play at all, and no position
> indicator appears to allow dragging or repositioning.
>
> Here are the response headers after I added it:
> Frame: Number = 434, Captured Frame Length = 1514, MediaType = ETHERNET
> + Ethernet: Etype = Internet IP
> (IPv4),DestinationAddress:[00-16-E6-8F-5E-9E],SourceAddress:[00-06-25-7F-45-9D]
> + Ipv4: Src = 209.67.188.9, Dest = 192.168.1.102, Next Protocol = TCP,
> Packet ID = 29397, Total IP Length = 1500
> + Tcp: Flags=...A...., SrcPort=HTTP(80), DstPort=63247, PayloadLen=1460,
> Seq=3634901546 - 3634903006, Ack=233418134, Win=64240 (scale factor 0x0) =
> 64240
> - Http: Response, HTTP/1.1, Status Code = 200, URL:
> /dev/webapp2/handler/getmediaobject.ashx
> ProtocolVersion: HTTP/1.1
> StatusCode: 200, Ok
> Reason: OK
> Cache-Control: public
> ContentLength: 449378
> ContentType: video/x-ms-wmv
> Expires: Sun, 14 Dec 2008 13:59:01 GMT
> Accept-Ranges: bytes
> Server: Microsoft-IIS/7.0
> XAspNetVersion: 2.0.50727
> XPoweredBy: ASP.NET
> Date: Fri, 14 Nov 2008 13:59:00 GMT
> Connection: close
> HeaderEnd: CRLF
> + payload: HttpContentType = video/x-ms-wmv
>
> It is odd you have such a hard time reproducing the issue. I have several
> computers here with a total of 4 browsers (FF2, FF3, IE6, IE7) and the only
> place it works is with IE7.
>
> Roger

 
Reply With Quote
 
Roger Martin
Guest
Posts: n/a
 
      14th Nov 2008
Thanks Bruce. I just discovered that if I modify my handler to use WriteFile,
it works:

FileInfo fi = new FileInfo(filePath);
context.Response.WriteFile(filePath, false);

However, this is not a long term solution because WriteFile has issues with
large files (http://support.microsoft.com/kb/812406). I need a reliable way
to send files to the user that won't overwhelm the server's memory; that's
why I was using a chunked approach.

There is nothing about a range in the request header:
Frame: Number = 433, Captured Frame Length = 1027, MediaType = ETHERNET
+ Ethernet: Etype = Internet IP
(IPv4),DestinationAddress:[00-06-25-7F-45-9D],SourceAddress:[00-16-E6-8F-5E-9E]
+ Ipv4: Src = 192.168.1.102, Dest = 209.67.188.9, Next Protocol = TCP,
Packet ID = 31490, Total IP Length = 1013
+ Tcp: [ReTransmit #430]Flags=...AP..., SrcPort=63247, DstPort=HTTP(80),
PayloadLen=973, Seq=233417161 - 233418134, Ack=3634901546, Win=65535 (scale
factor 0x0) = 65535
- Http: Request, GET /dev/webapp2/handler/getmediaobject.ashx
Command: GET
- URI: /dev/webapp2/handler/getmediaobject.ashx
Location: /dev/webapp2/handler/getmediaobject.ashx
ProtocolVersion: HTTP/1.1
Host: www.galleryserverpro.com
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.4)
Gecko/2008102920 Firefox/3.0.4 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,nl;q=0.8,en;q=0.5,de-ch;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie:
__utma=5214629.4168526968000403000.1223864238.1226617001.1226628470.137;
__utmz=5214629.1226167175.107.5.utmcsr=linkedin.com|utmccn=(referral)|utmcmd=referral|utmcct=/myprofile;
..ASPXANONYMOUS=ZqP1ljp8yQEkAAAAYTU1MmI2ODktMGI1Yy00Zjg3LTkzYTItMDlhMjdkN
HeaderEnd: CRLF

Given that it works using WriteFile and that there is no range in the
request, do you think I still need to add range support? I am doubtful but I
admit I am at the limits of my knowledge. Perhaps there is just a problem
with my chunking algorithm (see earlier for the code). I did a quick search
on adding range support in a handler but couldn't find anything - I don't
have a clue how I might do this.

Roger

"bruce barker" wrote:

> you actually have to add Range support to your handler, not just say you
> have it and ignore the range requests. look at the request to see if
> it has a range specified. a range specifies a offset and a length of
> bytes to return. that is you don't stream the whole file per request,
> just the bytes requested.
>
> ie7 is probably precaching the video (maybe a bug).


 
Reply With Quote
 
Hillbilly
Guest
Posts: n/a
 
      14th Nov 2008
Roger, just now 9:35ish am CST I was able to begin playback by clicking into
the viewport...
http://www.galleryserverpro.com/dev/webapp2/video2.aspx



"Roger Martin" <(E-Mail Removed)> wrote in message
news:E556377A-B380-4287-AAD5-(E-Mail Removed)...
> Thanks Bruce. I just discovered that if I modify my handler to use
> WriteFile,
> it works:
>
> FileInfo fi = new FileInfo(filePath);
> context.Response.WriteFile(filePath, false);
>
> However, this is not a long term solution because WriteFile has issues
> with
> large files (http://support.microsoft.com/kb/812406). I need a reliable
> way
> to send files to the user that won't overwhelm the server's memory; that's
> why I was using a chunked approach.
>
> There is nothing about a range in the request header:
> Frame: Number = 433, Captured Frame Length = 1027, MediaType = ETHERNET
> + Ethernet: Etype = Internet IP
> (IPv4),DestinationAddress:[00-06-25-7F-45-9D],SourceAddress:[00-16-E6-8F-5E-9E]
> + Ipv4: Src = 192.168.1.102, Dest = 209.67.188.9, Next Protocol = TCP,
> Packet ID = 31490, Total IP Length = 1013
> + Tcp: [ReTransmit #430]Flags=...AP..., SrcPort=63247, DstPort=HTTP(80),
> PayloadLen=973, Seq=233417161 - 233418134, Ack=3634901546, Win=65535
> (scale
> factor 0x0) = 65535
> - Http: Request, GET /dev/webapp2/handler/getmediaobject.ashx
> Command: GET
> - URI: /dev/webapp2/handler/getmediaobject.ashx
> Location: /dev/webapp2/handler/getmediaobject.ashx
> ProtocolVersion: HTTP/1.1
> Host: www.galleryserverpro.com
> UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.4)
> Gecko/2008102920 Firefox/3.0.4 (.NET CLR 3.5.30729)
> Accept:
> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Accept-Language: en-us,nl;q=0.8,en;q=0.5,de-ch;q=0.3
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
> Cookie:
> __utma=5214629.4168526968000403000.1223864238.1226617001.1226628470.137;
> __utmz=5214629.1226167175.107.5.utmcsr=linkedin.com|utmccn=(referral)|utmcmd=referral|utmcct=/myprofile;
> .ASPXANONYMOUS=ZqP1ljp8yQEkAAAAYTU1MmI2ODktMGI1Yy00Zjg3LTkzYTItMDlhMjdkN
> HeaderEnd: CRLF
>
> Given that it works using WriteFile and that there is no range in the
> request, do you think I still need to add range support? I am doubtful but
> I
> admit I am at the limits of my knowledge. Perhaps there is just a problem
> with my chunking algorithm (see earlier for the code). I did a quick
> search
> on adding range support in a handler but couldn't find anything - I don't
> have a clue how I might do this.
>
> Roger
>
> "bruce barker" wrote:
>
>> you actually have to add Range support to your handler, not just say you
>> have it and ignore the range requests. look at the request to see if
>> it has a range specified. a range specifies a offset and a length of
>> bytes to return. that is you don't stream the whole file per request,
>> just the bytes requested.
>>
>> ie7 is probably precaching the video (maybe a bug).

>


 
Reply With Quote
 
Roger Martin
Guest
Posts: n/a
 
      14th Nov 2008
Yes, that works for me, too. The problem is when you try to reposition the
slider either before playing or anytime after. Doing so causes the video to
be unplayable.

"Hillbilly" wrote:

> Roger, just now 9:35ish am CST I was able to begin playback by clicking into
> the viewport...
> http://www.galleryserverpro.com/dev/webapp2/video2.aspx

 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      14th Nov 2008
adding range support is easy. see the w3c http 1.1 spec for particulars. I
don't see how any streaming service could work reliably without range
support.

also be sure to turn buffering off.

-- bruce (sqlwork.com)


"Roger Martin" wrote:

> Thanks Bruce. I just discovered that if I modify my handler to use WriteFile,
> it works:
>
> FileInfo fi = new FileInfo(filePath);
> context.Response.WriteFile(filePath, false);
>
> However, this is not a long term solution because WriteFile has issues with
> large files (http://support.microsoft.com/kb/812406). I need a reliable way
> to send files to the user that won't overwhelm the server's memory; that's
> why I was using a chunked approach.
>
> There is nothing about a range in the request header:
> Frame: Number = 433, Captured Frame Length = 1027, MediaType = ETHERNET
> + Ethernet: Etype = Internet IP
> (IPv4),DestinationAddress:[00-06-25-7F-45-9D],SourceAddress:[00-16-E6-8F-5E-9E]
> + Ipv4: Src = 192.168.1.102, Dest = 209.67.188.9, Next Protocol = TCP,
> Packet ID = 31490, Total IP Length = 1013
> + Tcp: [ReTransmit #430]Flags=...AP..., SrcPort=63247, DstPort=HTTP(80),
> PayloadLen=973, Seq=233417161 - 233418134, Ack=3634901546, Win=65535 (scale
> factor 0x0) = 65535
> - Http: Request, GET /dev/webapp2/handler/getmediaobject.ashx
> Command: GET
> - URI: /dev/webapp2/handler/getmediaobject.ashx
> Location: /dev/webapp2/handler/getmediaobject.ashx
> ProtocolVersion: HTTP/1.1
> Host: www.galleryserverpro.com
> UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.4)
> Gecko/2008102920 Firefox/3.0.4 (.NET CLR 3.5.30729)
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Accept-Language: en-us,nl;q=0.8,en;q=0.5,de-ch;q=0.3
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
> Cookie:
> __utma=5214629.4168526968000403000.1223864238.1226617001.1226628470.137;
> __utmz=5214629.1226167175.107.5.utmcsr=linkedin.com|utmccn=(referral)|utmcmd=referral|utmcct=/myprofile;
> .ASPXANONYMOUS=ZqP1ljp8yQEkAAAAYTU1MmI2ODktMGI1Yy00Zjg3LTkzYTItMDlhMjdkN
> HeaderEnd: CRLF
>
> Given that it works using WriteFile and that there is no range in the
> request, do you think I still need to add range support? I am doubtful but I
> admit I am at the limits of my knowledge. Perhaps there is just a problem
> with my chunking algorithm (see earlier for the code). I did a quick search
> on adding range support in a handler but couldn't find anything - I don't
> have a clue how I might do this.
>
> Roger
>
> "bruce barker" wrote:
>
> > you actually have to add Range support to your handler, not just say you
> > have it and ignore the range requests. look at the request to see if
> > it has a range specified. a range specifies a offset and a length of
> > bytes to return. that is you don't stream the whole file per request,
> > just the bytes requested.
> >
> > ie7 is probably precaching the video (maybe a bug).

>

 
Reply With Quote
 
Roger Martin
Guest
Posts: n/a
 
      14th Nov 2008
Buffering is already turned off, as you can see in the code I posted.

I am pretty sure that adding range functionality won't solve the issue. Note
that I am not actually streaming the video, in the strict definition of
streaming. I am simply transmitting a file, and Silverlight has the
capability to begin playing the video when it has buffered enough of the
downloaded video. Ranges are not used anywhere in the request or response,
even in the examples that work.

As I said before, you can see for yourself by looking at my examples.

If knew how to easily add range functionality, I would do it just to see.
But it is not at all clear (at least to me) how to do it based on the spec
(http://www.w3.org/Protocols/rfc2616/rfc2616.html).

Roger

"bruce barker" wrote:

> adding range support is easy. see the w3c http 1.1 spec for particulars. I
> don't see how any streaming service could work reliably without range
> support.
>
> also be sure to turn buffering off.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Event Handler not firing for Silverlight page Alex. O. Koranteng Microsoft ADO .NET 6 6th Jul 2009 02:40 AM
Silverlight video doesn't work when file is streamed from handler Roger Martin Microsoft ASP .NET 3 13th Nov 2008 06:48 AM
Silverlight video doesn't work when file is streamed from handler Roger Martin Microsoft ASP .NET 0 6th Nov 2008 12:41 AM
need to jump down 4 cells, gather data, jump another 4 digitalsaint@gmail.com Microsoft Excel Programming 2 6th Oct 2006 01:49 PM
WMP or Direct Show: How do I jump to a specific part of a video fi =?Utf-8?B?a2NhbWhp?= Microsoft Dot NET 0 19th Nov 2005 12:35 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:25 AM.