0

I use android.widget.VideoView play online video, Some phones( Common Feature is use Qualcomm CPU) can't play, other can work well.

What is the cause of this ?

Code

package com.example.vv;

import android.app.Activity;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnErrorListener;
import android.media.MediaPlayer.OnPreparedListener;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

/**
 * @author jren
 * @parameter
 * @return
 */
public class MainActivity extends Activity {

    private static final String TAG = "LiveVideoPlay";
    private VideoView myVideoView;
    private MediaController mediaControls;
    MediaController mediaController;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        myVideoView = (VideoView) findViewById(R.id.videoview);
        playVideo();
    }

    private void playVideo() {
        try {
            if (mediaController == null) {
                mediaController = new MediaController(MainActivity.this);
            }
            myVideoView.setMediaController(mediaController);
            String StrUri = "http://huison.oss-cn-shenzhen.aliyuncs.com/0001/huison001/live.m3u8";
            Uri videoUri = Uri.parse(StrUri);
            myVideoView.setVideoURI(videoUri);
            myVideoView.setOnPreparedListener(new OnPreparedListener() {
                public void onPrepared(MediaPlayer mp) {
                    myVideoView.start();
                }
            });
            myVideoView.setOnErrorListener(new OnErrorListener() {
                @Override
                public boolean onError(MediaPlayer mp, int what, int extra) {
                    return false;
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.vv.MainActivity" >

  <VideoView
        android:id="@+id/videoview"
        android:layout_centerInParent="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</RelativeLayout>

the error:

07-14 15:14:25.872: E/MediaPlayer-JNI(25660): QCMediaPlayer mediaplayer NOT present 07-14 15:14:27.872: W/MediaPlayer(25660): info/warning (801, 0)

JoxTraex
  • 13,423
  • 6
  • 32
  • 45
Jren
  • 1
  • 1
  • I suggest that you add some code and if possible the link to the video that you are trying to play to try to reproduce it. – Raykud Jul 13 '16 at 08:22
  • add your code .maybe you try to call seekTo() with a zero value on a stream with no duration (live stream) – mehd azizi Jul 13 '16 at 10:55
  • Thanks for your reply ! @Raykud@mehdazizi I had added my code, Do you have some more advice? – Jren Jul 14 '16 at 07:38
  • so far what I found is that is a codec problem.. not all Android devices have all the codecs required. I would suggest using another codec (mp4 or other). I found some info here: http://stackoverflow.com/a/28724578/1084764 – Raykud Jul 15 '16 at 16:07

0 Answers0