gpt4 book ai didi

C# AxWindowsMediaPlayer 循环

转载 作者:太空狗 更新时间:2023-10-29 22:26:39 25 4
gpt4 key购买 nike

我遇到了这个烦人的问题,我无法查明哪里出错了。我正在用代码创建一个 Windows Media Player,我正在尝试循环播放视频……它循环播放,但只有一次……

因此它再次播放视频。然后它就停止并显示视频的结尾。所以它看起来好像只循环一次。

这是我的代码:

        try {
wmPlayer = new AxWMPLib.AxWindowsMediaPlayer();

wmPlayer.enableContextMenu = false;
((System.ComponentModel.ISupportInitialize)(wmPlayer)).BeginInit();
wmPlayer.Name = "wmPlayer";
wmPlayer.Enabled = true;
wmPlayer.Dock = System.Windows.Forms.DockStyle.Fill;
mainForm.Controls.Add(wmPlayer);
((System.ComponentModel.ISupportInitialize)(wmPlayer)).EndInit();
wmPlayer.uiMode = "none";

if(kind == "idle") {
IdleVideo(name);
}
}
catch { }
}

private static void IdleVideo(string name) {
System.Diagnostics.Debug.WriteLine("Video called once");
wmPlayer.URL = @"C:\ProjectSilver\assets\RadarDetectie\idle\" + name + "_idlescreen_movie.ogv";
Debug.WriteLine(wmPlayer.URL);
wmPlayer.settings.setMode("loop", true);

wmPlayer.Ctlcontrols.play();
}

所以希望大家帮帮忙,为什么一直播放不了呢?

最佳答案

只是使用

    private void Form1_Load(object sender, EventArgs e)
{
// give the path of your video here
axWindowsMediaPlayer1.URL = "Path of your video";
// this line will automatically start your video
axWindowsMediaPlayer1.settings.autoStart = true;
//here the system will automatially create a thread and will keep on
running your video...
axWindowsMediaPlayer1.settings.setMode("loop", true);
}

关于C# AxWindowsMediaPlayer 循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20022864/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com