简体   繁体   English

如何在不使用外部视频文件的情况下播放文件

[英]How to play file without using external video file

I want to have a video play within my program, however i dont want to refer to a video that is outside of my program, is there a way to have the video embedded into the program. 我希望在我的程序中播放视频,但是我不想参考我的程序之外的视频,有没有办法将视频嵌入到程序中。

I have tried refering to resources of the application and adding video there however this doesn't seem to be possible. 我尝试过引用应用程序的资源并在那里添加视频但是这似乎不可能。

axWindowsMediaPlayer1.URL = Properties.Resources.INTRO axWindowsMediaPlayer1.URL = Properties.Resources.INTRO

I would like to have the video play from the application and not have to know where the video is on the computer as this is something that will change from computer to computer. 我希望从应用程序中播放视频,而不必知道视频在计算机上的位置,因为这会从计算机变为计算机。

Looks like axWindowsMediaPlayer can't play video out of stream. 看起来像axWindowsMediaPlayer无法播放视频流。 Is is appropriate to you to save resource video to temporary file and then play it? 您是否适合将资源视频保存到临时文件然后播放?

var fileName = System.IO.Path.GetTempFileName();
File.WriteAllBytes(fileName, Properties.Resources.INTRO);
axWindowsMediaPlayer1.URL = fileName;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM