E/mediaplayer:should has subtitle controller already set

Source: Internet
Author: User

original link:http://stackoverflow.com/questions/20087804/ should-have-subtitle-controller-already-set-mediaplayer-error-android/20149754#20149754

1 StaticMediaPlayer Getmediaplayer (context context) {2 3MediaPlayer MediaPlayer =NewMediaPlayer ();4 5     if(Android.os.Build.VERSION.SDK_INT <Android.os.Build.VERSION_CODES. KITKAT) {6         returnMediaPlayer;7     }8 9     Try {Tenclass<?> Cmediatimeprovider = Class.forName ("Android.media.MediaTimeProvider" ); Oneclass<?> Csubtitlecontroller = Class.forName ("Android.media.SubtitleController" ); Aclass<?> Isubtitlecontrolleranchor = Class.forName ("Android.media.subtitlecontroller$anchor" ); -class<?> Isubtitlecontrollerlistener = Class.forName ("Android.media.subtitlecontroller$listener" ); -  theConstructor Constructor = Csubtitlecontroller.getconstructor (NewClass[]{context.class, Cmediatimeprovider, Isubtitlecontrollerlistener}); -  -Object subtitleinstance = constructor.newinstance (Context,NULL,NULL); -  +Field f = Csubtitlecontroller.getdeclaredfield ("Mhandler"); -  +F.setaccessible (true); A         Try { atF.set (Subtitleinstance,NewHandler ()); -         } -         Catch(Illegalaccessexception e) {returnMediaPlayer;} -         finally { -F.setaccessible (false); -         } in  -Method Setsubtitleanchor = Mediaplayer.getclass (). GetMethod ("Setsubtitleanchor", Csubtitlecontroller, isubtitlecontrolleranchor); to  +Setsubtitleanchor.invoke (MediaPlayer, Subtitleinstance,NULL); -         //log.e ("", "subtitle is setted:p"); the}Catch(Exception e) {} *  $     returnMediaPlayer;Panax Notoginseng}

This code was trying to does the following from the hidden API

1 New NULL NULL ); 2 New Handler (); 3 null)

E/mediaplayer:should has subtitle controller already set

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.