Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Closed Captions in MPMoviePlayerController for iPhone

I'm trying to play a movie that has closed captions embedded in the file (.scc) using an instance of MPMoviePlayerController. I've read the documentation and don't see support to turn captions on with this class. I know Apple allows a user to turn on captions for movies from iTunes. Anyone know of a particular way to do this that I might be overlooking?

like image 404
Chris Avatar asked Dec 30 '09 20:12

Chris


People also ask

How do I Turn on closed captions for media on iPhone?

You can turn on closed captions for media as your default on iPhone or iPad; here’s how. Tap General. Select Accessibility. Choose Subtitles & Captioning. Toggle Closed Captions + SDH on.

Can I use mpmovieplayercontroller in iOS 9?

The MPMoviePlayerController class is formally deprecated in iOS 9. (The MPMoviePlayerViewController class is also formally deprecated.) To play video content in iOS 9 and later, instead use the AVPictureInPictureController or AVPlayerViewController class from the AVKit framework, or the WKWebView class from WebKit.

How to enable closed captions and subtitles in Samsung Galaxy S20?

In the Settings menu, scroll down and tap on “Accessibility”. Next, scroll down and choose “Subtitles & Captioning” located under the Hearing category, as shown below. Now, simply tap on the toggle to turn on closed captions and subtitles for deaf and hard of hearing. If you want to customize how your subtitles look, tap on “Style”.

Does macOS support closed captions and subtitles?

macOS supports closed captions and subtitles in these native apps: iTunes, DVD Player, QuickTime Player, and HTML5 video viewed in Safari. If you don’t see the speech bubble, the video you’re watching does not include captions or subtitles


2 Answers

On iOS 4.0 and later, you can also use the AVPlayer class. It natively supports closed caption (see the closedCaptionDisplayEnabled property).

like image 170
user574535 Avatar answered Oct 24 '22 21:10

user574535


Unfortunately, as far as I know, there's no way to do this automatically. However, it's not too hard to do by yourself if you're using iOS3.2+.

In iOS3.2+, MPMoviePlayerController conforms to the MPMediaPlayback protocol, meaning that you can access at any time the "playback head" to determine where you are in the file.

I don't know about the SCC file format in particular, but if you had a list of subtitles and start/end timecodes associated with them (which appears to be the basis of most of the subtitle formats out there), you could just check the "playback head" time at regular intervals, see if it matches any of the sets of subtitles you have, and display by adding a subview to the movie view.

like image 37
makdad Avatar answered Oct 24 '22 22:10

makdad