Video Scrubbing in iTunes
For years, I’ve used college course websites to help supplement my learning. If you poke around, you’ll find a lot of sites with lecture notes, code samples, and assignments all posted online. You don’t need to enroll in the course, or even attend college, to benefit from these little nuggets of learning. Sometimes it beats bashing your head against a new topic, without any sort of plan.
iTunes U
My only real problem with this method has been lack of access to the lecture itself. iTunes U has been around for a while, with many schools offering access to videos and notes classroom lectures. Its been gaining steady traction, to the point where I’m pretty sure you could do an entire undergraduate degree online.
There’s even an app for iOS that allows you to access all the content on your mobile device alongside your computer. Speirs has a great article discussing iTunes U, if you’re really interested in all the technical details.
Currently I’ve got one monitor up playing the lecture, with slides up on my iPhone (here’s one thing I’d love an iPad for), and a browser and programming tools up on the main monitor. Granted, this whole solution isn’t as beneficial as personal access to a professor to answer your questions and make sure you’re learning the material. Then again, its a heck of a lot cheaper.
On the whole, the experience has been very reminiscent of sitting in a lecture with my laptop open. Including the unfortunate point where I get distracted for a few moments and suddenly snap my attention back to the professor, trying to remember what he just said. Unlike an actual lecture, I can quickly rewind so I don’t miss anything.
Video Scrubbing
I’ve been watching a lot of videos with Plex lately, and I’ve gotten hooked on its fast forward and rewind keyboard shortcuts. Namely, the right arrow skips forward 30 seconds, the left arrow rewinds 15 seconds, the up arrow skips forward 10 minutes, and the down arrow rewinds 10 minutes. Much to my dismay, I hit a giant brick wall when trying to do something similar in iTunes. It just doesn’t have any built in functionality for this. Scrubbing using the progress bar and mouse is doable, but nowhere near as fast, and requires careful attention.
If I view the content on my iOS device, there is a dedicated rewind 30s button. This works great, but watching hours of lectures on my iPhone is a bit much. I tried using AirPlay to stream it to the TV, and it worked out ok. That said, I don’t really want to be in front of the TV all the time, so this is out. In iTunes, if you change the Media Kind for each of the video files from iTunes U to Podcast, suddenly the 30s skip backwards button appears on the computer. So I’ve got skip on the computer, but in a severely limiting form. I can do better.
Creating a Solution
My final solution to the problem was of course, programmatic. I started out by opening Automator and creating 4 new Services: Forward 30s, Rewind 15s, Forward 10m, Rewind 5m. Each Service will only work with iTunes, and takes no input. The script for each service differs only in the first line. The script simply changes the player position of the current track based on the skipAmount value.
Then, hit up System Preferences > Keyboard > Keyboard Shortcuts and bind the arrow keys to these services.
While my initial script worked fine, I made a few refinements. First, I check for a current track, which gets rid of an error message if you press a hotkey when there is no track playing. Second, I added checks for skipping before the start or past the end of the track, which was causing the player to exit when this happened.
Final Product
And here’s the same code for cut and paste:
property skipAmount : -300 on run {input, parameters} tell application "iTunes" if current track exists then if (player position + skipAmount) is greater than (start of current track) ¬ and player position is less than ((finish of current track) - skipAmount) then set player position to (player position + skipAmount) end if end if end tell return input end run
Now I’m able to scrub through lectures with ease. One can always hope that Apple will bake in this kind of functionality, but I doubt it. Until then, I’ll make due with clever hacks.