VB.NET Playing Video From My.Resources Automatical

2019-09-18 05:51发布

问题:

I'm basically trying to play a video on Axwindowsmediaplayer from my resources, so it could be seen from other computers besides mine (just taking it from my Resources). And I came up with this.

 Dim b As Byte() = My.Resources.My_Video
 Dim TheFIlePath As String = "My Video.mp4"
 Dim TempFile As System.IO.FileStream = IO.File.Create(TheFIlePath)
 TempFile.Write(b, 0, b.Length)
 TempFile.Close()
 Me.AxWindowsMediaPlayer1.URL = (TheFIlePath)

Is there anyway to avoid creating - spawning my video on my Filepath? Or at least mask it? Like it appears as a DLL or SRT file but anything besides the .MP4? Even hiding it, dunno just don't let it lie there as a simple .MP4.

回答1:

This is possible with lower level APIs, however Windows Media Player (and its ActiveX form factor in particular) needs both real file system file and extension identifying the format.