Мне нужно воспроизвести следующее видео (в качестве потока) на Android: http://advertision.mediaworks.co.nz/vid ... образного/> Он отвечает всем требованиям. На этой странице говорится: http://developer.android.com/guide/appe ... tmlобразно http://atomicparsley.sourceforge.net/), чтобы увидеть, был ли атом MOOV до атомов MDAT и после атома FTYP, как предусмотрено вышеуказанная страница:
"для 3GPP и MPEG-4 контейнеры, атом MOOV должен предшествовать любым MDAT ATOM, но принять на FTYP Atom. "
Все в порядке. Но видео просто не играет. Он называет MediaPlayes «обратный вызов хорошо, но он не играет. Кроме того, MediaPlayer.getVideowIdth () и MediaPlayer.getVideoHeight () (в коде Bellow) возвращают оба 0 (даже если видео составляет 640x360). < /P>
Следуйте за моим методом.@Override
public void onPrepared(MediaPlayer mediaplayer) {
width = mediaPlayer.getVideoWidth();
height = mediaPlayer.getVideoHeight();
//Get the width of the screen
int screenWidth = getWindowManager().getDefaultDisplay().getWidth();
//Get the SurfaceView layout parameters
android.view.ViewGroup.LayoutParams lp = surfaceView.getLayoutParams();
//Set the width of the SurfaceView to the width of the screen
lp.width = screenWidth;
//Set the height of the SurfaceView to match the aspect ratio of the video
//be sure to cast these as floats otherwise the calculation will likely be 0
lp.height = (int) (((float)height / (float)width) * (float)screenWidth);
//Commit the layout parameters
surfaceView.setLayoutParams(lp);
playPauseImageButton.setImageResource(R.drawable.ic_media_pause);
//if (width != 0 && height != 0) {
surfaceHolder.setFixedSize(width, height);
seekBar.start();
mediaPlayer.start();
//}
playPauseImageButton.setEnabled(true);
}
< /code>
Я также установил обратный вызов Onerror, но он никогда не вызывается. Какие -нибудь идеи кто -нибудь?
Подробнее здесь: https://stackoverflow.com/questions/217 ... s-not-play