2016-04-29 49 views
0

我創建了一個AudioPlayerDelegate來通過我的音頻播放器播放導航文本,但函數playText()在導航過程中永遠不會被調用,而另一個函數playFiles()會被調用。這裏Android SDK AudioPlayerDelegate不起作用

下面的代碼片段:

private class MyAudioPlayerDelegate implements AudioPlayerDelegate { 

     @Override 
     public boolean playText(String s) { 

      TTSController.getInstance(HEREMapActivity.this).playText(s); 
      return true; 
     } 

     @Override 
     public boolean playFiles(String[] strings) { 
      Log.d("voice", strings.toString()); 
      return true; 
     } 
    } 


    if (myAudioPlayerDelegate == null) { 
      myAudioPlayerDelegate = new MyAudioPlayerDelegate(); 
    } 
     navigationManager.getAudioPlayer().setDelegate(myAudioPlayerDelegate); 

回答

0

看來你是不使用支持TTS語音皮膚。只有TTS皮膚會回調到playText()方法。

+0

謝謝大衛,我錯過了在設置NavigationManager的VoiceSkin時調用voicePackage.isTts()。 (voicePackage.isTts()) {id = voicePackage.getId(); 休息; } } –