简体   繁体   English

Microsoft.DirectX.AudioVideoPlayback程序不起作用

[英]Microsoft.DirectX.AudioVideoPlayback program not working

I'm trying to write a simple program that I'm going to be using inside another program for playing back audio and video files using the Microsoft.DirectX.AudioVideoPlayback.dll file. 我正在尝试编写一个简单的程序,该程序将在另一个程序中使用Microsoft.DirectX.AudioVideoPlayback.dll文件播放音频和视频文件。 I've got the code listed below since it doesn't have to be incredibly complex. 我已经在下面列出了代码,因为它不必非常复杂。 The problem that I am having is that... well, the program does nothing. 我遇到的问题是……很好,该程序什么也不做。 Not even the main window shows up and I don't know why. 甚至主窗口都没有出现,我也不知道为什么。 I'm using .Net 4.0 and the DirectX DLL version says it's 1.0.2902.0. 我使用的是.Net 4.0,DirectX DLL版本说它是1.0.2902.0。 I tried moving the initialization for the audio and video files to different places (The load event and the button press event specifically). 我尝试将音频和视频文件的初始化移动到不同的位置(特别是load事件和按钮按下事件)。 When in the button press event, the form loads, but as soon as I press a button, the program hangs. 在按钮按下事件中,将加载表单,但是一旦我按下按钮,程序就会挂起。 No errors or anything. 没有错误或任何东西。 Anyone know what is going on here? 有人知道这是怎么回事吗? If someone has a better idea for playing audio and video files, I'm willing to consider that too. 如果有人对播放音频和视频文件有更好的主意,我也愿意考虑。

using Microsoft.DirectX.AudioVideoPlayback;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MediaPlayer
{
    public partial class Player : Form
    {
        Audio derp;
        Video herp;        
        public Player()
        {
            InitializeComponent();
            this.derp = new Audio("<Audio File Name>");
            this.herp = new Video("<Video File Name>");
            this.herp.Owner = this.panel1;            
        }
        private void btnPlayPauseStop_Click(object sender, EventArgs e){            
            switch(((Button)sender).Text){
                case "Play":
                    if (!herp.Playing)
                        herp.Play();
                    break;
                case "Pause":
                    if (!herp.Paused)
                        herp.Pause();
                    break;
                case "Stop":
                    if (!herp.Stopped)
                        herp.Stop();
                    break;
            }
        }
        private void Player_Load(object sender, EventArgs e)
        {            

        }
    }
}

I have been using this for making my very own "Media Player Classic" clone 我一直在用它制作我自己的“ Media Player Classic”克隆

Be sure to debug this in 32 bit mode: Project Menu --> {project} Properties ... --> Build --> Platform Target = x86 确保以32位模式进行调试:项目菜单-> {project}属性...->构建->平台目标= x86

For video, I do not load Audio (it gets done automatically). 对于视频,我不加载音频(它会自动完成)。 So instead of using both, use only the one needed (video or audio) 因此,不要同时使用两者,而只使用所需的一种(视频或音频)

The next thing is to ensure that the panel is visible and big enough to see (check the size after "new Video(...)") 接下来是确保面板可见且足够大以查看(检查“ new Video(...)”之后的大小)

暂无
暂无

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

相关问题 SharpDX中的Microsoft.DirectX.AudioVideoPlayback替代 - Microsoft.DirectX.AudioVideoPlayback alternative in SharpDX Activemovie窗口在C#中弹出Microsoft.DirectX.AudioVideoPlayback - Activemovie window pop up Microsoft.DirectX.AudioVideoPlayback in C# 通过Microsoft.DirectX.AudioVideoPlayback显示对视频播放的控制 - Display a Control over video playing via Microsoft.DirectX.AudioVideoPlayback 找不到参考Microsoft.DirectX.AudioVideoPlayback - Can't find reference Microsoft.DirectX.AudioVideoPlayback 找不到引用Microsoft.DirectX.AudioVideoPlayback和Microsoft.DirectX - can't find references Microsoft.DirectX.AudioVideoPlayback and Microsoft.DirectX c#使用Microsoft.DirectX.AudioVideoPlayback如何在完成一个视频后播放下一个视频 - c# using Microsoft.DirectX.AudioVideoPlayback how to play next video after one is finished 使用Microsoft.DirectX.AudioVideoPlayback播放视频时出错; 程序集版本错误 - Error playing video using Microsoft.DirectX.AudioVideoPlayback; assembly version error C#winform,使用Microsoft.DirectX.AudioVideoPlayback dll中的Video / Audio类后,应用程序崩溃 - C# winform, App Crashing after using the Video/Audio classes from the Microsoft.DirectX.AudioVideoPlayback dll C#Microsoft.DirectX.AudioVideoPlayback.Video参考? - C# Microsoft.DirectX.AudioVideoPlayback.Video reference? Windows窗体不会与DirectX.AudioVideoPlayback一起显示-C# - Windows Form won't show with DirectX.AudioVideoPlayback - C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM