0

I want to play a 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 error :

"The specified network name is no longer available"

on the line

return Response.AsStream(() => File.OpenRead(@"E:\test_videos\test.mp4"), "video/mp4");

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

Update: I could play video on FireFox and IE, the error only occurs in chrome.

increddibelly
  • 1,221
  • 1
  • 15
  • 25
kubilay
  • 43
  • 14

3 Answers3

0

You probably need to set a static convention, and serve the files directly without passing them trough nancy.

Sunny Milenov
  • 21,990
  • 6
  • 80
  • 106
0

I have implemented mp4handler for nancyfx and it worked.

kubilay
  • 43
  • 14
-2

Your backslashes are probably getting filtered out of existence, try replacing '\' with '\ \', (no space in there) otherwise looks ok to me

Homer
  • 89
  • 2
  • 1
    He is using @"~..." so the '\' are ignored. – Austin T French Apr 13 '15 at 13:43
  • 1
    The @ sign in @"E:\test_videos\test.mp4" ensures you don't need to escape - in this case - slashes anymore. See: http://stackoverflow.com/questions/556133/whats-the-in-front-of-a-string-in-c –  Apr 13 '15 at 13:43
  • yes, it is not about '\' since it is working on txt.files like => File.OpenRead(@"E:\test.txt") – kubilay Apr 14 '15 at 05:33