@Override public void onConnected(PlaybackService service) { mService = service; initSleep(); initPlaybackSpeed(); if (mMode == MODE_VIDEO) { // Init Chapter final MediaPlayer.Chapter[] chapters = mService.getChapters(-1); final int chaptersCount = chapters != null ? chapters.length : 0; if (chaptersCount > 1) { int index = mService.getChapterIdx(); if (chapters[index].name == null || chapters[index].name.equals("")) mChaptersTitle.setText(getResources().getString(R.string.chapter) + " " + index); else mChaptersTitle.setText(chapters[index].name); } else mChaptersTitle.setVisibility(View.GONE); // Init Audio Delay long audiodelay = mService.getAudioDelay() / 1000l; if (audiodelay == 0l) { mAudioDelay.setText(null); mAudioDelay.setCompoundDrawablesWithIntrinsicBounds( 0, Util.getResourceFromAttribute(mActivity, R.attr.ic_audiodelay), 0, 0); } else { mAudioDelay.setText(Long.toString(audiodelay) + " ms"); mAudioDelay.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_audiodelay_on, 0, 0); } // Init Subtitle Delay long spudelay = mService.getSpuDelay() / 1000l; if (spudelay == 0l) { mSpuDelay.setText(null); mSpuDelay.setCompoundDrawablesWithIntrinsicBounds( 0, Util.getResourceFromAttribute(mActivity, R.attr.ic_subtitledelay), 0, 0); } else { mSpuDelay.setText(Long.toString(spudelay) + " ms"); mSpuDelay.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_subtitledelay_on, 0, 0); } } }