So, in short, I’ve created a screensaver that randomly chooses a movie and plays that instead of the default Windows screensavers.
I’ve got a few movies converted to DIVX (.avi) format and have them all saved in a particular folder on my server at home and thought it would be much more fun to have a movie-based screensaver and so set about trying to make one.
I stumbled into MSDN’s Coding4Fun website and found a WPF project on there that someone has done well in writing, which displays various images across the screen. Great.
Then, it all got much better unexpectedly, as when I ran their screensaver code on my PC, I found that they’re also catering for the multi-monitor-folk, meaning that the images are different on each monitor. Fantastic! (Hopefully, you can see where I’m going with this…)
A few deletions here and there in their code and added a call direct to a movie to see if it would work. And it did. Dirty Harry played well on my two monitors, but I wanted to see how far I could go.
I then made a quick-and-dirty .Net app to skim through the folders on my server and recorded each movie within a quick SQL Server Express database.
A little Linq-to-SQL here and there and within minutes, I had the WPF screensaver application running, randomly choosing a movie for each monitor available (in my case two) and displaying them on separate screens. And it did this when the system was idle for a few minutes.
It was originally 10 minutes, but patience was out of the window… I needed to play!
The next problem was something I didn’t expect at first, but soon found the remedy; when the movies started playing, they mostly displayed the title credits and some took ages before seeing any real action. So, in the code, I made each movie jump exactly 37 minutes in, as after half-an-hour, you’d expect to see something more interesting, right?
The next problem, was that there are then two movies (or however many screens you have) playing simultaneously and so you get two sets of sound effects coming through the speakers! (Dur!) This would manifest itself as having the shooting scenes from one movie overlaid over another, which wasn’t too bad until Die Hard and Atonement would come up at the same time… So, I’ve taken the fairly drastic step at the moment of just muting the lot.
So, the result is a screensaver that randomly chooses the movies each time, meaning that coming back to your PC takes slightly longer to do, as each time I seem mesmerised and simply have to watch a few minutes of each before returning to whatever I was doing.
I haven’t done any more to the screensaver as yet, but hope to, as the problem is that I haven’t seen some of the movies that it throws up for me, so I end up watching 5-10 minutes of the movie, part-way through and in mute. I was thinking that I could put a label in the corner of the screen, showing the name of the movie to help give me a clue!
And, maybe I could trap the event firing for a certain key that could toggle the sound for a given monitor…
Also, ideally, the movie will show for 5 minutes and then the power management for the PC should kick-in and power-down the monitors?
Thoughts and opinions are welcome.

No comments:
Post a Comment