VB中的多个Windows Media Player [英] Multiple Windows Media Players in VB

查看:89
本文介绍了VB中的多个Windows Media Player的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道如何在3到4个玩家中播放1个窗口媒体文件并且

然后同时开始和停止?



我想要做的是同时在3或4个玩家中播放相同的文件,并且

让它们同时开始和停止。



现在当我加载它们时,它们会在每个玩家准备就绪后立即显示。

有时候它的玩家1首先启动,其他时候它的玩家3等等。



是否有等待,命令或其他东西我可以检查以确保每个人都已加载并准备好玩然后开始他们都在玩吗?



感谢你的任何想法......

Dose anyone know of a way to play 1 window media file in 3 to 4 players and
make then all start and stop at the same time?

What I want to do is play the same file in 3 or 4 players at the same time and
have them all start and stop at the same time.

Right now when I load them they display as soon as each player is ready and play.
Some times its player 1 that starts first, other times its player 3 and so on.

Is there a wait, command or something I can check to make sure each one is loaded and ready to play then start them all playing?

Thanks for any idea you might have...

推荐答案

你可以玩一个文件通过DirectShow并在具有多个视频渲染器的视频流上使用Inf Tee Filter,或者使用一个VMR9 / EVR与自定义分配器演示器并同时在耦合渲染目标上显示目标表面。因此,您需要仅为多个视图控制一个图形和一个文件回放。
You can play one file via DirectShow and use Inf Tee Filter on video stream with multiple video renderers, or use one VMR9/EVR with custom allocator presenter and present target surface on couple render targets at the same time. So you will need to control one graph and one file playback only for multiple view.


如果在分配文件名后立即开始播放,则必须具有autoStart = true。



启动多个玩家的技术似乎有用(我只会声称没有更多)

1)开始一个玩家

2)等到玩完状态达到

3)对其他玩家重复1和2

4)暂停所有玩家

5)将所有玩家的播放位置设置为0

6)重启所有游戏



步骤4和可能不需要6,因为同步看起来与删除它们相同。



You must have autoStart = true if playback starts as soon as a filename is assigned.

A technique for starting multiple players which seems to work (I''ll claim nothing more than that) is
1) Start a player
2) Wait until the playing state is achieved
3) Repeat 1 and 2 for other players
4) Pause all players
5) Set the playback position of all players to 0
6) Restart play for all

Steps 4 and 6 are probably not required as synchronisation looks the same with them removed.

Private Sub Start(filename As String)
    REM players are AxWMPLib.AxWindowsMediaPlayer

    player1.settings.autoStart = False
    player1.URL = filename

    player2.settings.autoStart = False
    player2.URL = filename

    player1.Ctlcontrols.play()
    While player1.playState <> WMPLib.WMPPlayState.wmppsPlaying
        Application.DoEvents()
        System.Threading.Thread.Sleep(20)
    End While

    player2.Ctlcontrols.play()
    While player2.playState <> WMPLib.WMPPlayState.wmppsPlaying
        Application.DoEvents()
        System.Threading.Thread.Sleep(20)
    End While
    
    REM synchronise the players
    player1.Ctlcontrols.pause()
    player2.Ctlcontrols.pause()
    player1.Ctlcontrols.currentPosition = 0.0
    player2.Ctlcontrols.currentPosition = 0.0
    player1.Ctlcontrols.play()
    player2.Ctlcontrols.play()
End Sub





你我将不得不原谅在这个概念验证代码中使用Application.DoEvents和Sleep!



Alan。



You''ll have to excuse the use of Application.DoEvents and the Sleep in this "proof of concept" code!

Alan.


这篇关于VB中的多个Windows Media Player的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆