iosobjective-cmpmovieplayercontrollermpmovieplayer

MPMoviePlayerViewController remove "Audio and Subtitles" control


I am playing a live stream video with MPMoviePlayerViewController and I want to disable the bottom right button for "Audio and Subtitles". The only solution I have found for this is to set the moviePlayer.controlStyle property to MPMovieControlStyleNone, but that hides all the controls.

Is there any way to customize a MPMoviePlayerViewController to hide the subtitles button?


Solution

  • Here is the reason why the button is there, and the way to hide it :

    Video Player unexpectedly shows Alternate Track button for Subtitles and Captions

    The source material will have to include: CLOSED-CAPTIONS=NONE on the EXT-X-STREAM-INF tag to remove the Button.

    Edit :

    I've been searching on "how to insert HTTP headers for a URL" and found a few interesting results. First, if you really want to insert HTTP headers to your URL, the following might do the job :

    NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];
    [request setValue:@"NONE" forHTTPHeaderField:@"CLOSED-CAPTIONS"];
    

    If it's not what you're searching for, the solution suggested here could make the job :

    I think setting a cookie might solve your problem. Please look into the documentation for NSHTTPCookie and NSHTTPCookieStorage.

    If it's still not working, take a look at this related question.

    Finally, if all those steps didn't help, implement your own control bar thanks to this tutorial.