2015-02-27 2 views
16

Ho un problema con il mediaplayer da quando ho aggiornato la mia versione di Android a 5.0.2 sul mio lg-smartphone.Android: Impossibile trovare QCMediaPlayer

ho una classe separata per riprodurre la musica

public class MediaPlayerService { 

    public static MediaPlayer mediaPlayer; 
    private static SoundPool soundPool; 
    public static boolean isplayingAudio = false; 
    static int soundID; 

    public static enum State { 
     Stopped, 
     Playing, 
    } 

    static State mState = State.Stopped; 

    public static void playAudioFromMediaPlayer(Context c) { 

     mediaPlayer = new MediaPlayer(); 
     mediaPlayer = MediaPlayer.create(c, R.raw.hooray); 
     if (!mState.equals(State.Stopped)) { 
       mediaPlayer.start(); 
       mState = State.Playing; 
     } 
    } 

    @SuppressWarnings("deprecation") 
    public static void loadAudioFromSoundPool(Context c, int id) { 

     soundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 100); 
     soundID = soundPool.load(c, SoundList.soundList.get(id), 1); 
    } 

    public static void playAudioFromSoundPool() { 

     soundPool.play(soundID, 1, 1, 0, 0, 1); 
    } 

    public static boolean isMediaPlayerPlaying() { 
     if (mState.equals(State.Playing)) { 
      return true; 
     } 
     return false; 
    } 

    public void releaseMediaPlayer() { 
     if(mediaPlayer != null || mediaPlayer.isPlaying()) {  
      mediaPlayer.stop(); 
      mediaPlayer.release(); 
      mediaPlayer = null; 
     } 
    }  

    public void releaseSoundPool() { 

    } 
} 

voglio giocare un file audio sul Mainactivity con

MediaPlayerService.playAudioFromMediaPlayer(getApplicationContext(), soundID); 

ma sono diventato il seguente registro-messaggio:

02-27 12:36:15.829: E/ExtMediaPlayer-JNI(11743): QCMediaPlayer could not be located.... 
02-27 12:36:15.829: E/MediaPlayer-JNI(11743): QCMediaPlayer mediaplayer NOT present 
02-27 12:36:15.854: E/ExtMediaPlayer-JNI(11743): QCMediaPlayer could not be located.... 
02-27 12:36:15.854: E/MediaPlayer-JNI(11743): QCMediaPlayer mediaplayer NOT present 
02-27 12:36:15.908: E/MediaPlayer(11743): Should have subtitle controller already set 
02-27 12:36:15.930: E/ExtMediaPlayer-JNI(11743): QCMediaPlayer could not be located.... 
02-27 12:36:15.930: E/MediaPlayer-JNI(11743): QCMediaPlayer mediaplayer NOT present 
02-27 12:36:15.931: E/ExtMediaPlayer-JNI(11743): QCMediaPlayer could not be located.... 
02-27 12:36:15.931: E/MediaPlayer-JNI(11743): QCMediaPlayer mediaplayer NOT present 
02-27 12:36:15.958: E/MediaPlayer(11743): Should have subtitle controller already set 
02-27 12:36:15.962: E/MediaPlayer(11743): Should have subtitle controller already set 
02-27 12:36:16.018: E/MediaPlayer(11743): Should have subtitle controller already set 

Con soundpool funziona bene, ma non con il mediaplayer. Qual è la ragione di ciò e come posso risolverlo?

Grazie in anticipo e sry per il mio inglese :)

+0

Vi siete mai andati oltre? – newenglander

risposta

3

Non credo che la vostra piattaforma supporta l'uso di QCMediaPlayer ho paura - è per questo che si sta dando tutti questi errori è possibile saperne di più, cercando a questa fonte:

https://github.com/fallowu/slim_hardware_qcom_media/blob/master/QCMediaPlayer/com/qualcomm/qcmedia/QCMediaPlayer.java

Se fossi in te mi piacerebbe restare a utilizzare soundpool per il momento.

+0

Ho ricevuto lo stesso errore sul mio dispositivo Asus. Ma ciò che è interessante, l'ho preso in un video, ma un altro suona corretto. Entrambi i video hanno gli stessi codec audio e video e lo stesso bitrate. Qualcuno potrebbe dire un suggerimento su cosa sta accadendo? –