如何检测,如果任何视频现在正在播放? [英] How to detect if any video is being played now?

查看:713
本文介绍了如何检测,如果任何视频现在正在播放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检测,如果任何视频现在正在发挥使用的AutoHotkey AutoIt的,的 VBScript中,的 C#,或的ç

How to detect if any video is being played now using autohotkey, autoit, vbscript, c#, or c?

视频可以播放/流在任何地方播放器,基于网络的播放器或HTML5播放器。我们不知道球员的名字也播放器可能无法在全屏显示。

Video could be being played/streamed in any local player, web based player, or html5 player. We do not know the name of player also player may not be in the full screen.

PS。检测CPU负载可能无法给出正确的结果总是,所以它是不能接受的。

PS. Detecting CPU load may not give the correct result always, so it is not acceptable.

推荐答案

我所做的工作,小一点这个在当天返回。还有就是得到一个WIN32API(老派)/套是否要禁用屏幕保护程序(在user32.dll中,GetScreenSaverActive(),SetScreenSaverActive - 参见:的 HTTP://www.$c$cproject.com/Articles/17067/Controlling-The-Screen-Saver-With- ç)。这是最有可能标志当视频播放进行设置,但它不是100%可靠,因为不是每个玩家都会实现它。这将适用于大多数浏览器的视频,无论是通过演奏插件,本地或通过DirectX的。这也适用于大多数(所有?)外部播放器,如VLC和WinDVD等。

I've done a small bit of work on this back in the day. There is a WIN32API (old school) that gets/sets whether or not to disable the screensaver (in user32.dll, GetScreenSaverActive(), SetScreenSaverActive - see: http://www.codeproject.com/Articles/17067/Controlling-The-Screen-Saver-With-C). This is the most likely flag to be set when a video is playing but it not 100% reliable as not every player will implement it. It WILL work for most browser videos, whether played through plugin, natively, or via DirectX. This also works for most (all?) external players such as vlc, windvd, etc.

不过。

有没有肯定火,确定视频播放的100%的方式。你不能;
 1.检查声音扮演,用户可使用iTunes,而不是所有的视频​​没有声音
 2.检查全屏幕(通常是更好的选择)作为视频可以在浏览器中播放
 因为它是不可靠的,你没有其他办法确定3.检查CPU / GPU的负载
 4.一定要确保玩家还没有散尽最小化时/复位的win32标志

There is no sure-fire, 100% way of determining a video playing. You cannot; 1. Check for sound playing as the user may be using iTunes and not all videos have sound 2. Check for full screen (usually the better option) as the video may be playing in a browser 3. Check cpu/gpu load as it's not reliable and you have no other way to determine 4. Be absolutely sure that the player hasn't cleared/reset the win32 flag when minimized

另一种办法是尝试和整理possile可执行名称的列表中的所有著名球员(可行的,但费时查找数据,espesially在旧版本),并检查他们是否正在运行。这是不是100%可靠无论是作为一个插件,通过以下preloaded但浏览器但实际上没有打在那一刻视频的时间。

Another option would be to try and collate a list of possile executable names for all known players (doable but time consuming to find data, espesially on older versions), and check to see if they're running. This isn't 100% reliable either as a plugin by be preloaded but a browser but not actually playing a video at that moment in time.

在短,没有100%的方式,我知道,但几种方法,你拿90%-95%存在。这就是知道,如果有一个视频播放的目的是什么?也许有找到你要找一个更简单的方法了...

In short, there's no 100% way that I know of but several ways that'll get you 90-95% there. That is the purpose of knowing if there's a video playing? Perhaps there's an easier way to find what you're looking for...

这篇关于如何检测,如果任何视频现在正在播放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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