Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My problem is simple, i have video file stored as a resource inside my executable. And i need to play it... But it just doesn't work. It says that it cant find the file for some reason.
I need to fix this and play a embedded video.

What I have tried:

Tried using different formats. .gifs work fine, and simple images like .jpg work fine too. But .mp4, .mkv, .wmv don't work. Didn't try more formats yet. But it works if i use video file which is external, not embedded in executable,

I tried using Media Element and even embedding vlc, and its always the same. "Cant find the video..."

Here's some code:
(DIDN'T WORK)
XML
<wpf:VlcPlayer x:Name="vlcPlayer"/>

C#
vlcPlayer.LoadMedia(@"/Resource/videok.wmv");
vlcPlayer.Play();

------------------------------
(WORKED FINE) (but its not what i want)
XML
<Image gif:ImageBehavior.AnimatedSource="/Resource/videobackground.gif"></Image>

------------------------------
(DIDN'T WORK TOO)
XML
<MediaElement MediaEnded="Loginbackground_MediaEnded"  Source="/Resource/videok.wmv" Name="Loginbackground" ></MediaElement>


Tried using different file paths like
XML
pack://application:,,,/myproject;component/Resource/videob.mp4

and
XML
myproject;component/Resource/ideob.mp4


Tried changing build mode on my videos to Resource, Content, Embedded Resource and None. Still nothing.
Posted
Updated 6-Jul-18 20:40pm
v3
Comments
MadMyche 6-Jul-18 10:11am    
Are you using an SDK, API, ActiveX component for this; and if so, which?
skindervik 6-Jul-18 11:04am    
oh woops, didn't see where comments are on this site, I'm new.
Well, im not sure what counts as SDK, API, ActiveX, but the only third party things i tried using were from NuGet packages "Meta.Vlc", "Meta.Vlc.lib", "Meta.Vlc.Wpf" and "WpfAnimatedGif". Didn't really add anything else.
MadMyche 6-Jul-18 11:49am    
Did you look up the references for these to see samples? I have not for this, but this NuGet pkg https://www.nuget.org/packages/Vlc.DotNet.Wpf/ has links to the GIT repo with sample code
skindervik 6-Jul-18 13:04pm    
OK, im not sure whats happening, but if you see 3 replies, sry, but they keep disappearing. Gonna try the last time:
I just tried the samples u said, but its just another video player that works the same as any other. I already have two working video player, one default player, and other vlc that i wrote. They both work fine. But none can play embedded videos... Instead of trying every player on earth, if you know how to make a program that has a video inside, and can play it, show me the way...

1 solution

 
Share this answer
 
Comments
skindervik 7-Jul-18 4:54am    
what, how is this related? can no one understand me ;[

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900