Android-ScalableVideoView icon indicating copy to clipboard operation
Android-ScalableVideoView copied to clipboard

is Pobile to play video from url?

Open fedesenmartin opened this issue 8 years ago • 9 comments

I want to play video from url,as is inherit from MediaPlayer I suppose it cans,has something specifilc?

Im not able to play it

Thanks!

fedesenmartin avatar Apr 07 '16 15:04 fedesenmartin

try {
            scalableTextureView.setDataSource(context, videoUri);
            scalableTextureView.prepareAsync(new MediaPlayer.OnPreparedListener() {
                @Override
                public void onPrepared(MediaPlayer mp) {
                    scalableTextureView.start();
                }
            });
        } catch (IOException e) {
            e.printStackTrace();
        }

ghost avatar May 12 '16 16:05 ghost

@Sam-kh

try { Uri uri = Uri.parse(url); scalableVideoView.setDataSource(UIUtils.getContext(),uri); scalableVideoView.setLooping(true); scalableVideoView.prepareAsync(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { scalableVideoView.start(); } });

    } catch (IOException e) {
        e.printStackTrace();
    }

05-16 03:39:58.818 28479-28479/com.budong.gif E/MediaPlayer: setDataSource: IOException! uri=http://ac-MjIf6Nns.clouddn.com/9805633f518e60b9. java.io.FileNotFoundException: No content provider: http://ac-MjIf6Nns.clouddn.com/9805633f518e60b9. at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1108) at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:946) at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:873) at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1003) at android.media.MediaPlayer.setDataSource(MediaPlayer.java:968) at com.yqritc.scalablevideoview.ScalableVideoView.setDataSource(ScalableVideoView.java:148) at com.budong.gif.utils.VideoManager.startVideo(VideoManager.java:35) at com.budong.gif.activity.MainActivity.showView(MainActivity.java:494) at com.budong.gif.activity.MainActivity.access$500(MainActivity.java:87) at com.budong.gif.activity.MainActivity$1.done(MainActivity.java:319) at com.budong.gif.protocol.GifProtocols$1.done(GifProtocols.java:32) at com.budong.gif.protocol.GifProtocols$1.done(GifProtocols.java:28) at com.avos.avoscloud.FunctionCallback.internalDone0(FunctionCallback.java:45) at com.avos.avoscloud.AVCallback$1.run(AVCallback.java:12) at android.os.Handler.handleCallback(Handler.java:815) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loop(Looper.java:199) at android.app.ActivityThread.main(ActivityThread.java:5755) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:982) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:777)

why?????

fansangg avatar May 14 '16 07:05 fansangg

@fansangg The video file which you're trying to play does not exist.

ghost avatar May 14 '16 22:05 ghost

@Sam-kh Uri uri = Uri.parse(url); scalableVideoView.setDataSource(UIUtils.getContext(),uri);

it's not video file,it's a uri. but the video can play correctly.

fansangg avatar May 15 '16 14:05 fansangg

@fansangg Your uri is http://ac-mjif6nns.clouddn.com/9805633f518e60b9 and it should be pointing to a video which you wanna play. Now if you open the uri in your browser, it shows a json document which contains an error with message "Document not found". Also you have a java.io.FileNotFoundException in your log which means there's no video to play.

Provide a valid uri then it should work.

ghost avatar May 15 '16 22:05 ghost

@Sam-kh "http://ac-MjIf6Nns.clouddn.com/9805633f518e60b9." This uri is valid, you can play video in a browser, can also play in the app. but Logcat shows error FileNotFoundException

fansangg avatar May 16 '16 01:05 fansangg

@fansangg Sorry for late response. I believe u are missing internet permission in manifest. Add the following line in ur manifest and retry playing.

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

yqritc avatar May 24 '16 01:05 yqritc

Could you solve it? I have the same problem.

AminJun avatar Dec 19 '17 20:12 AminJun

@fansangg @AminJun did you guys found a solution ? what i found is if i use this in onCreate method it works fine. but same link if i get it from firebase it gives me and error

       try {
            Log.e("Get Data Count ", " its here ");
            Uri urii = Uri.parse("http://clips.vorwaerts-gmbh.de/VfE_html5.mp4");
            mVideoView.setDataSource(SquareCameraActivity.this, urii);
            mVideoView.setVolume(0, 0);
            mVideoView.setLooping(true);
            mVideoView.prepare(new MediaPlayer.OnPreparedListener() {
                @Override
                public void onPrepared(MediaPlayer mp) {
                    mVideoView.start();
                }
            });
        } catch (IOException ioe) {
            //ignore
            Log.e("Get Data Count ", String.valueOf(ioe));
        }```

ashfaaaa avatar Feb 06 '18 20:02 ashfaaaa