I am search for a way to detect if video is playing on Windows OS (7,8,10).
SetThreadExecutionState api function does not help I have tryied with different players (VLC, BS player etc.) but it seems they don't use flag ES_DISPLAY_REQUIRED.
Checking for disabled screensaver is not good solution, because it should be allowed at first place and almost nobody use screensavers nowdays.
My app is a break timer, I am using LASTINPUTINFO() function but I want to know
when the user is watching video because there is not input (keyboard or mouse) during this time.
A dirty and partial solution would be if the app does snapshot of region in the center of the screen and comparing hashes, but it will be 90% accurate.
Any better ideas?
Related
I'd like to create a simple application for Android that would automate some processes that happen in different applications that I don't have under my control at all. Is there any way to get pixel color and simulate screen touch while my application runs in background?
Let's say I want to wait for a certain pixel to turn red (#FF0000), can I use GetPixel(x,y) to get the color and then simulate a screen touch event such as a swipe across the screen?
I tried to Google this but I've got nothing useful at all and now I'm quite desperate about this.
I had to search a bit for this. I was also looking for this solution.
NO ROOTING REQUIRED FOR THIS:
If you want to repeat a sequence of steps like fill a form, repeat game steps because redoing is boring, You can try : FREP Android App from Play Store(Link).
If you want to add conditional scenarios like, when you play Clash of Clans with home Wifi, turn data automatically and disable wifi ( Because Airtel Wifi in India is unpredictable and can make you loose the clan war!!) use, Macro Droid from Play Store.
You can try these as well:
Mahiro
Many apps are available based on Tasker like, Auto Input. You can maybe code/write macro to make personal solution with this Tasker App.
I made a game where user navigates a character. Since it is designed for both PC and tablet (with Win8), there are two options how to do it.
1) using keyboard (Key_Down and Key_Up events)
2) using touch and hold (Tapped and Holding events)
Unfortunately there is a problem with Holding event, because it raises after a long time period (I think 1 sec). I had to use word long there becase it really is a long time period in games.
Now, I need a better solution. There is a onscreen joystick in the game compounded from four images that stands for arrows. How do I make player's character move immediately and continuously just by tap-and-hold on the arrow image?
I'am using javascript for metro app dev and there I'am using MSPointerDown/MSPointerUp for nearly the same. Maybe it is simlar in c#? Can this link help?
I am working on an application that plays a video using the MediaElement component. Now, I would like that if the user is idle, the lock screen appears, as configured by the user in the Settings of the device.
If I don't play a video, the lock screen indeed appears. But, when a video is playing no lock screen appears. I cannot find any information on this.
Currently I set the idle detection modes like this:
PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Enabled;
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Enabled;
I am a bit lost now. The only solution I can think of is running a timer myself and stop the video playback after a certain time. (but there seems to be no API calls to receive the configured lock timeout.)
Any suggestions are welcome, thanks.
One workaround for you would be to enable running under the lockscreen. Then in the obscured even you could stop the mediaplayer. Not ideal, but it might serve your purposes.
I'm building a Windows Forms application in VS 2010 that smoothly increases or decreases the speed of a video playing back based on the speed of the user input.
I've tried several avenues..
1.) Using the AudioVideoPlayback DirectX class - I set the speed of the video, by setting the current position of the video, based on a timer.. and increased or decreased that value based on user input. While this worked on my PC, it lags a lot on our lower end target PC's. Can anyone think of a more efficient way to increase/decrease the speed of playback using this class?
2.) I've tried the Windows Media Player ActiveX control, and tried setting the rate/position dynamically, but this is extremely jumpy and laggy even on my development PC
3.) I've tried the Apple QuickTime Control 2.0 COM Component that comes with VS 2010, and it's also very laggy.
4.) I'm trying to figure out how to set the speed on the Shockwave Flash Object control, but haven't found that out yet
Can anyone suggest other avenues to explore? I just need to be able to increase/decrease the speed of video playback smoothly based on user input without lag. I don't care what format the video needs to be in, all videos can be converted to the required format.
Any help/ideas will be appreciated.
Thanks
The ultimate way is to decode the Bitmaps from videos, and handle the frames yourself.
Try the CaptureNET example from DirectShow.NET. It allows you to capture bitmaps from each frame. After that, write your own playback control to handle the refresh rate.
After trying many different formats/libraries and components I found the VLC Media Player ActiveX control to be the most efficient method to slow down/speed up video without any noticeable lag.
i have an application that records a date/time when the space bar is pressed
unfortunately, the window doesn't always have focus, for various reasons. eg virus checker popup, itunes update, windows update, etc
so what i though would be a cool idea is to use a joystick button, then regardless of which window has focus, i can always detect the button press event and record the date/time it was pressed.
now i had a look at a few game tutorials, but they seem to have the joystick polling tied into the screen refresh event, because in a game i guess if the computer is slow and the screen doesn't refresh often, having the joystick button pressed is going to make no difference anyway.
That doesn't really suit my need, so i am looking at running a thread that will poll the joystick every so often
My questions are
is a background thread the best solution
how often should i poll the joystick
what kind of timer should i use to determine the polling frequency.
I would like the responses to be at least equivalent to a keyboard. also need to make sure it doesn't auto-repeat if trigger is held down.
any sample code (C#) appreciated
thanks
alex
If you want to go for polling the joystick just because you are not able to capture the keyboard event, I think you need to re-work your strategy.
Even if your form doesn't have the focus there are ways that you can make sure you know of the keyboard state.
You could set up a system wide keyboard hook which can be done in C# using the SetWindowsHookEx API call.
This is delving a little in unmanaged code and Windows API, but I think it's a better idea than polling a joystick cause you won't need to add a joystick to your computer just because you need to capture datetime at the press of a spacebar.
Do a little search on google for keyboard hooks in C#. It's easier than many people believe.
I don't think using a timer object to do this is a good idea at all. Cause I believe you said you need to do it at the press of a key.
Your best bet would be to create a Timer object on your form, and tie the joystick check to the Tick event.
I've also found that running simple stuff like this every 100ms (10 times a second) has a negligible effect on CPU usage.
Use something like AHK (Auto HotKey) it is a simple language that can be compiled to an EXE and is designed for automating the keyboard and mouse, I'm not 100% sure how well it works with a joystick, but I'm sure it's possible they managed to write some stuff for the wii remotes.
Also the IRC Channel and Forums always have people willing to help if need be.