Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MediaElement can't play network paths containing a #

Tags:

windows

wpf

My F:\ drive is a mapped network drive. I have two videos on it:

F:\Video1.mp4
F:\Video#1.mp4

I'd like to use a MediaElement to play them.

<MediaElement Source="F:\Video1.mp4" />  <!-- works -->
<MediaElement Source="F:\Video#1.mp4" />  <!-- doesn't work -->

It seems the # is being treated as %23 when it is a network path. This works fine if F:\ is a local drive.

How can I make F:\Video#1.mp4 work? It is a legitimate path.

like image 606
Julien Avatar asked Aug 08 '17 14:08

Julien


1 Answers

Try creating a URI with file:/// prepended:

mediaElement.Source = new Uri( "file:///" + @"F:\Video#1.mp4" );

This Social post says that worked for them.

like image 65
Lynn Crumbling Avatar answered Nov 15 '22 21:11

Lynn Crumbling