Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is this error I got when using VideoView : MediaPlayer(29449): Error (1,-1004) in android
    primarykey
    data
    text
    <p>I want to play live stream using <code>VideoView</code> but what is the error I got error :</p> <pre><code>04-21 21:13:27.326: D/MediaPlayer(29449): Couldn't open file on client side, trying server side 04-21 21:13:27.529: D/dalvikvm(29449): GC_CONCURRENT freed 81K, 2% free 9218K/9328K, paused 5ms+3ms, total 28ms 04-21 21:14:17.654: E/MediaPlayer(29449): error (1, -1004) 04-21 21:14:17.654: E/MediaPlayer(29449): Error (1,-1004) 04-21 21:14:17.654: D/VideoView(29449): Error: 1,-1004 </code></pre> <p>My code to play the live streaming : </p> <pre><code>public class VideoStreamingActivity extends Activity implements OnPreparedListener,OnErrorListener{ private Vibrator vibrator; private boolean readyToPlay; private ProgressBar progress; private ProgressDialog loading; private TextView mediaTimeElapsed; private TextView mediaTime; private TextView mediaInfo; private Button play; private Button stop; private String url; private VideoView vvStreaming; private CountDownTimer timer; /** Called when the activity is first created.*/ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.activity_video_streaming); //variables init vvStreaming = (VideoView)findViewById(R.id.vvStreaming); url ="http://www.ted.com/talks/download/video/8584/talk/761"; play = (Button)findViewById(R.id.btnPlay); stop = (Button)findViewById(R.id.btnPause); mediaInfo = (TextView) findViewById(R.id.tvMediaInfo); mediaTime = (TextView)findViewById(R.id.tvTime); mediaTimeElapsed = (TextView)findViewById(R.id.tvTimeElapsed); progress = (ProgressBar) findViewById(R.id.progressBar1); loading = new ProgressDialog(this); loading.setMessage("Loading..."); vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); //flag indicating that content is ready for playback readyToPlay = false; // listeners for VideoView: //vvStreaming.setOnPreparedListener(this); //vvStreaming.setOnErrorListener(this); vvStreaming.setVideoURI(Uri.parse(url)); vvStreaming.setMediaController(new MediaController(this)); vvStreaming.start(); } @Override public boolean onError(MediaPlayer mp, int what, int extra) { loading.hide(); return false; } @Override public void onPrepared(MediaPlayer mp) { Log.d(this.getClass().getName(), "prepared"); mp.setLooping(true); loading.hide(); //onVideoSizeChangedListener declaration /* mp.setOnVideoSizeChangedListener(new OnVideoSizeChangedListener() { @Override public void onVideoSizeChanged(MediaPlayer mp, int width, int height) { if(width!=0 &amp;&amp; height!=0) { Log.d(this.getClass().getName(), "logo off"); logo.setVisibility(ImageView.INVISIBLE); } else { Log.d(this.getClass().getName(), "logo on"); logo.setVisibility(ImageView.VISIBLE); } } });*/ //onBufferingUpdateListener declaration mp.setOnBufferingUpdateListener(new OnBufferingUpdateListener() { // show updated information about the buffering progress @Override public void onBufferingUpdate(MediaPlayer mp, int percent) { Log.d(this.getClass().getName(), "percent: " + percent); progress.setSecondaryProgress(percent); } }); //onSeekCompletionListener declaration mp.setOnSeekCompleteListener(new OnSeekCompleteListener() { //show current frame after changing the playback position @Override public void onSeekComplete(MediaPlayer mp) { if(mp.isPlaying()) { // playMedia(null); // playMedia(play); } else { // playMedia(null); // playMedia(play); // playMedia(null); } // mediaTimeElapsed.setText(countTime(vvStreaming.getCurrentPosition())); } }); mp.setOnCompletionListener(null); readyToPlay = true; int time = vvStreaming.getDuration(); int time_elapsed = vvStreaming.getCurrentPosition(); progress.setProgress(time_elapsed); timer = new CountDownTimer(time, 500) { @Override public void onTick(long millisUntilFinished) { // mediaTimeElapsed.setText(countTime(vvStreaming.getCurrentPosition())); float a = vvStreaming.getCurrentPosition(); float b = vvStreaming.getDuration(); progress.setProgress((int)(a/b*100)); } @Override public void onFinish() { // stopMedia(null); } }; //onTouchListener declaration progress.setOnTouchListener(new OnTouchListener() { // enables changing of the current playback position @Override public boolean onTouch(View v, MotionEvent event) { ProgressBar pb = (ProgressBar) v; int newPosition = (int) (100 * event.getX() / pb.getWidth()); if (newPosition &gt; pb.getSecondaryProgress()) { newPosition = pb.getSecondaryProgress(); } switch (event.getAction()) { // update position when finger is DOWN/MOVED/UP case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_UP: pb.setProgress(newPosition); vvStreaming.seekTo((int) newPosition * vvStreaming.getDuration() / 100); break; } return true; } }); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload