nirvanatikku/jQuery-TubePlayer-Plugin — pull request #13 by dzuelke (2012-05-04 09:40:34+00:00)
Title: Force sURL to string in getVideoIDFromURL() to fix errors when there is no video URL (yet)

Calling `$player.tubeplayer("data")` will fail if done very early on after video playback started (e.g. in an `onPlayerUnstarted` callback) because the YT player API returns `undefined` for the video URL at that point in time (it'll work fine shortly thereafter), which will cause `TubePlayer.getVideoIDFromURL()` to break when invoking `indexOf()` on what it believes to be a string.

This change simply forces an empty string when necessary, so the parsing will not error out. It won't succeed either of course, and return an empty string (IMO the function should return `null` rather than an empty string in such cases), but at least then `$player.tubeplayer("data")` will return something instead of failing.