I did some work over the weekend to improve Able Player's support for YouTube videos. The changes will be available in the next major release of Able Player, which I'll be unveiling in my session at CSUN.
The biggest challenge with playing YouTube videos in a third-party player is getting access to captions. I described the issues in a previous blog post, Handling Captions via the YouTube Player API. The biggest problem with the YouTube IFrame API, which is used to embed a YouTube player in a web page, is that the API exposes captions and subtitles only after the onAPIChange event is fired, which doesn't happen until the video starts playing. This makes it very difficult to construct the player, as we don't know whether to include a CC button, and whether clicking on that button should display a pop-up menu for selecting available languages.
The workaround I used in Able Player was to autostart the video and play it for just long enough to trigger the onApiChange event, then reset the video back to the start and collect the caption data that had been exposed during the brief moment of playback. This is a clumsy hack, and I've been looking for a better way.Continue reading