0

Here is the full log:

03-20 22:49:26.953 4986-4986/? I/art: Not late-enabling -Xcheck:jni (already on)
03-20 22:49:26.955 4986-4986/? W/art: Unexpected CPU variant for X86 using defaults: x86
03-20 22:49:27.232 4986-4986/com.example.alphie.androidvideostream W/System: ClassLoader referenced unknown path: /data/app/com.example.alphie.androidvideostream-1/lib/x86
03-20 22:49:27.250 4986-4986/com.example.alphie.androidvideostream I/InstantRun: starting instant run server: is main process
03-20 22:49:27.535 4986-4986/com.example.alphie.androidvideostream W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
03-20 22:49:27.737 4986-5002/com.example.alphie.androidvideostream I/OpenGLRenderer: Initialized EGL, version 1.4
03-20 22:49:27.737 4986-5002/com.example.alphie.androidvideostream D/OpenGLRenderer: Swap behavior 1
03-20 22:49:27.738 4986-5002/com.example.alphie.androidvideostream W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
03-20 22:49:27.738 4986-5002/com.example.alphie.androidvideostream D/OpenGLRenderer: Swap behavior 0
03-20 22:49:27.741 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglCreateContext: 0x9f6316c0: maj 3 min 0 rcv 3
03-20 22:49:27.743 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)
03-20 22:49:27.784 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)
03-20 22:58:08.625 4986-4986/com.example.alphie.androidvideostream W/MediaPlayer: Couldn't open https://youtu.be/oEgpGv2CF1U: java.io.FileNotFoundException: No content provider: https://youtu.be/oEgpGv2CF1U
03-20 22:58:08.635 4986-4998/com.example.alphie.androidvideostream D/NetworkSecurityConfig: No Network Security Config specified, using platform default
03-20 22:58:08.666 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)
03-20 22:58:09.980 4986-5049/com.example.alphie.androidvideostream E/MediaPlayer: error (1, -2147483648)
03-20 22:58:09.980 4986-4986/com.example.alphie.androidvideostream E/MediaPlayer: Error (1,-2147483648)
03-20 22:58:09.980 4986-4986/com.example.alphie.androidvideostream D/VideoView: Error: 1,-2147483648
03-20 22:58:10.069 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)
03-20 22:58:10.092 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)
03-20 22:58:10.131 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)
03-20 22:58:10.141 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)
03-20 22:58:11.625 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)
03-20 22:58:11.647 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)
03-20 22:58:11.661 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)
03-20 22:58:11.669 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)
03-20 22:58:11.675 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)
03-20 22:58:11.745 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)
03-20 22:58:11.759 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)
03-20 22:58:11.927 4986-5002/com.example.alphie.androidvideostream D/EGL_emulation: eglMakeCurrent: 0x9f6316c0: ver 3 0 (tinfo 0x9d6fe6a0)

"can't play video" error displays after hitting play button

As you can see, I have internet with the uses permission. heres my AndroidManifest.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest 
       xmlns:android="http://schemas.android.com/apk/res/android"
            package="com.example.alphie.androidvideostream">

    <uses-permission android:name="android.permission.INTERNET"/>


    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" 
      />
          </intent-filter>
      </activity>
     </application>

     </manifest>

and here is my java for my MainActivity:

   package com.example.alphie.androidvideostream;

   import android.app.ProgressDialog;
   import android.media.MediaPlayer;
   import android.net.Uri;
   import android.support.v7.app.AppCompatActivity;
   import android.os.Bundle;
   import android.view.View;
   import android.widget.ImageButton;
   import android.widget.ImageView;
   import android.widget.VideoView;

   public class MainActivity extends AppCompatActivity  implements 
        View.OnClickListener {

    ProgressDialog mDialog;
    VideoView videoView;
    ImageButton btnPlayPause;

     String videoURL = "https://youtu.be/oEgpGv2CF1U";

    @Override
     protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
     setContentView(R.layout.activity_main);

    videoView= (VideoView)findViewById(R.id.videoView);
    btnPlayPause = (ImageButton)findViewById(R.id.btn_play_pause);
    btnPlayPause.setOnClickListener(this);
   }

    @Override
     public void onClick(View v) {
     mDialog = new ProgressDialog(MainActivity.this);
     mDialog.setMessage("Please wait...");
     mDialog.setCanceledOnTouchOutside(false);
     mDialog.show();

    try
    {
        if(!videoView.isPlaying()) {
        Uri uri = Uri.parse(videoURL);
        videoView.setVideoURI(uri);
        videoView.setOnCompletionListener(new 
          MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                btnPlayPause.setImageResource(R.drawable.ic_play);
            }
        });
    }
        else
        {
            videoView.pause();
            btnPlayPause.setImageResource(R.drawable.ic_play);
        }
    }
    catch (Exception ex )
    {

    }
    videoView.requestFocus();
    videoView.setOnPreparedListener(new 
      MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            mDialog.dismiss();
            mp.setLooping(true);

            videoView.start();
            btnPlayPause.setImageResource(R.drawable.ic_pause);
        }
    });
    }
    }

As you can see, I have parsed the url and am using uri so that way i can get a remote video. any ideas? thanks

1 Answer 1

1

https://youtu.be/oEgpGv2CF1U points to a website, not a video stream. An example of a video stream URI would be rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov.

It used to be possible to get YouTube stream URIs using the YouTube API, but it was changed in 2015. I suggest you launch the video in the YouTube app, as detailed here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.