Click here to Skip to main content
13,597,584 members
Rate this:
 
Please Sign up or sign in to vote.
Hi,

I want to play local video file from nancy embedded http server. It is ok to read a txt file but once it tries to open a video file it gives "The specified network name is no longer available" error on the line
return Response.AsStream(() => File.OpenRead(@"E:\test_videos\test.mp4"), "video/mp4");

I can play the video from browser so what is wrong then?

Update: I could play video on firefox and IE, the error occur only in chrome.
Posted 13-Apr-15 3:33am
Updated 14-Apr-15 20:24pm
v3
Comments
‭011111100010‬ 14-Apr-15 8:42am
   
Sounds like you need to change a chrome setting.
kubibay 14-Apr-15 9:49am
   
Or I should change the way reading stream for video file but how? I can do it in web project using mp4handler, but I don't know how to implement that handler for embedded http server library.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

This piece of code is not enough to guess why it happens, especially when you state that it happens only in Chrome...

I'd suggest to read these:
Error Message: The specified network name is no longer available. [^] - here you'll find some description about the reasons,
http://stackoverflow.com/questions/8741474/returning-a-stream-from-file-openread[^]
  Permalink  
Comments
kubibay 16-Apr-15 8:00am
   
The first link seems broken and the second not really helped.
I know it is not enough to get the problem but I thought maybe someone had similar problem before. It seems nobody did.

The thing is I have to use embedded server - I chosed NancyFx for this -
And I need to play local video file from this http server.

When I go this address from chrome "file:///E:/test_videos/test.mp4" the video plays.
But when I try to do it from httpserver just chrome gives the error.

It is so much confusing..
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

I have implemented mp4handler for nancyfx and it worked.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180621.3 | Last Updated 17 Apr 2015
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100