0
我正在從網絡服務器播放視頻,視頻正在播放視頻很好,但一些三星移動90度旋轉播放視頻。但是同樣的視頻在其他設備上沒有定量播放。當從網絡服務器播放時,Android視頻被旋轉
public void playVideo(String videoPath) {
try {
vidFull.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setOnInfoListener(new MediaPlayer.OnInfoListener() {
@Override
public boolean onInfo(MediaPlayer mp, int what, int extra) {
switch (what) {
case MediaPlayer.MEDIA_INFO_BUFFERING_START:
progressBar.setVisibility(View.VISIBLE);
break;
case MediaPlayer.MEDIA_INFO_BUFFERING_END:
progressBar.setVisibility(View.GONE);
break;
}
return false;
}
});
}
});
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(vidFull);
vidFull.setMediaController(mediaController);
vidFull.setVideoPath(videoPath);
vidFull.requestFocus();
vidFull.start();
videoArrayLength = videoArrayLength -1;
vidpointer = 1;
//Goutam 17.03.2016
vidFull.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
logCollection.setLogERed(""+videoArrayLength);
try {
if (videoArrayLength > 0){
MediaController mediaController = new MediaController(FullPost.this);
mediaController.setAnchorView(vidFull);
vidFull.setMediaController(mediaController);
//vidFull.setVideoPath("http://www.sample-videos.com/video/mp4/480/big_buck_bunny_480p_1mb.mp4");
logCollection.setLogERed(basevideourl+videoArray.optJSONObject(vidpointer).getString("vdLink"));
vidFull.setVideoPath(basevideourl + videoArray.optJSONObject(vidpointer).getString("vdLink"));
vidFull.requestFocus();
vidFull.start();
videoArrayLength = videoArrayLength - 1;
vidpointer = vidpointer + 1;
}else {
logCollection.showToastLong("No more video to play.");
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
} catch (Exception e) {
// TODO: handle exception
Toast.makeText(this, "Error connecting", Toast.LENGTH_SHORT).show();
}
}
請幫忙,提前致謝。
活動是在清單中的肖像,這不是一個問題,當播放videoview和所有人像模式,但只有視頻在某些三星手機旋轉。 –