Cannot Load Video from S3 AWS( Android Studio ) - android

I'm trying to load video from my S3 AWS service.
The problem is that every time I try to load video, I'm getting:
D/MediaPlayer﹕ Couldn't open file on client side, trying server side
E/MediaPlayer﹕ error (1, -2147483648)
E/MediaPlayer﹕ Error (1,-2147483648)
D/VideoView﹕ Error: 1,-2147483648
I don't know if it's problem with permissions? This is my Android Code:
AWSCredentials myCredentials = new BasicAWSCredentials("my-key", "secret-key");
AmazonS3 s3client = new AmazonS3Client(myCredentials);
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest("-", "AndroidCommercial.3gp");
objectURL = s3client.generatePresignedUrl(request);
videoview = (VideoView) findViewById(R.id.videoView);
getWindow().setFormat(PixelFormat.TRANSLUCENT);
MediaController mediaCtrl;
mediaCtrl = new MediaController( MainActivity.this );
mediaCtrl.setMediaPlayer(videoview);
videoview.setMediaController(mediaCtrl);
Uri clip = Uri.parse(String.valueOf(objectURL));
videoview.setVideoURI(clip);
videoview.requestFocus();
videoview.start();
I'm not sure if it's problem with AWS or my APP... I've created user with AmazonS3FullAccess policy. I can download that file with AWS chrome extension. Can anyone help me?
Best Regards, Mateusz

Related

VideoView unable to play video using an url

I'm trying to play a video using a url but it's not working. It always give me error on screen as Can't play this video.
I'm using below snippet:
val uri: Uri = Uri.parse(it.url)
binding.videoView.setVideoURI(uri)
val mediaController = MediaController(activity)
mediaController.setAnchorView(binding.videoView)
mediaController.setMediaPlayer(binding.videoView)
binding.videoView.setMediaController(mediaController)
binding.videoView.setOnPreparedListener { binding.videoView.start() }
Logcat Error:
E/MediaPlayerNative: error (1, -1015)
E/MediaPlayer: Error (1,-1015)
I'm getting the YouTube url mostly. Thanks in advance.

android Videoview not playing .sdp files what should i do?

I am making live tv channel streaming app.
But when i try to play the .sdp files in the android videoview it gives the error that "Sorry can't play this video".But it is playing .mp4 and .3gp videos successfully.
What should i do.I googled alot but in vain.
String VideoURL = "rtsp://pull.newclear.tv/live/livestream2_160p";
//"rtsp://pull.newclear.tv/live/livestream2_160p";
//.sdp links are also giving same error
//links of above type are not working
This is my code for videoview
MediaController mediacontroller = new MediaController(
VideoViewActivity.this);
mediacontroller.setAnchorView(videoview);
// Get the URL from String VideoURL
Uri video = Uri.parse(VideoURL);
videoview.setMediaController(mediacontroller);
videoview.setVideoURI(video);

android videoview error 1, -2147483648

I am getting error while playing video from asset folder and raw folder.
MediaPlayer error (1, -2147483648)
VideoView error 1, -2147483648.
I tried from asset folder as.
private String SrcPath = "file:///android_asset/aaa.mp4"; //also tried aaaa.mp3
VideoView vv = (VideoView)findViewById(R.id.videoView1);
vv.setVideoPath(SrcPath);
MediaController controller = new MediaController(this);
controller.setAnchorView(vv);
vv.setMediaController(controller);
vv.requestFocus();
vv.start();
and for raw folder i used URI as :
Uri video = Uri.parse("android.resource://com.usecontentprovider/raw/aaa.mp4");
vv.setVideoURI(video);
I got the same error message in both cases.
You can use software like avinaptic2 to get the video encoding information and make sure it matches the supported media formats in android.
A common problem I find is that videos are encoded with the wrong profiling. H.264 videos need to be encoded with Baseline level 3 or under to be played without errors or artifacts in Android.
I found the solution as I am able to play video on virtual device.
I replaced the line
Uri video = Uri.parse("android.resource://com.usecontentprovider/raw/aaa.mp4");
with
Uri video = Uri.parse("android.resource://com.usecontentprovider/raw/"+R.raw.aaa);
And its working
Using R.raw works fine but in some cases I still get the same error. Fortunately I found the solution to my problem: I had to call videoView.start() inside onPrepare().
You can check the correct answer here:
Android: 'Can't play this video'; MediaPlayer & VideoView Error 1 -38

Can't Play RTSP Stream (3gp encode) on Android 2.2

I tried to play a RTSP stream "rtsp://217.146.95.166:554/playlist/ch27yqcif.3gp" (this stream tested on KM Player and it is alive)
and also tried to play from "m.youtube.com" but not success. It give me an error "Sorry this video cannot be played" when the program run.
here is my code.
VideoView videoView = (VideoView) findViewById(R.id.myvideoView);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
Uri video = Uri.parse("rtsp://217.146.95.166:554/playlist/ch27yqcif.3gp");
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
The app run and download data for sometime and give me the error "Sorry this video cannot be played"
when I try this http link it play well.
http://3gpvideos.org/wp-content/uploads/2012/13/Ishq%20Mein%20Ruswaa%20Full%20Song.3gp
I tried so many different RTSP links and formats but not successful.
What is the wrong with this code.
log details..
05-16 08:52:38.633: D/MediaPlayer(275): Couldn't open file on client side, trying server side
05-16 08:53:52.272: W/MediaPlayer(275): info/warning (1, 26)
05-16 08:53:52.272: I/MediaPlayer(275): Info (1,26)
05-16 08:53:52.313: E/MediaPlayer(275): error (1, -1)
05-16 08:53:52.313: E/MediaPlayer(275): Error (1,-1)
05-16 08:53:52.313: D/VideoView(275): Error: 1,-1

Google TV VideoView playing YouTube rtsp videos

I am accessing a video link via the YouTube API thusly:
JSONObject(videoString).getJSONObject("entry")
.getJSONObject("media$group").getJSONArray("media$content")
.getJSONObject(0).getString("url");
Which gives me a link to a video such as:
rtsp://v7.cache5.c.youtube.com/CiILENy73wIaGQlXg0iXvlQ9SBMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp
I then try to play the video with:
mVideoView.setVideoURI(result);
final MediaController mediaController = new MediaController(mActivity);
mVideoView.setMediaController(mediaController);
mVideoView.requestFocus();
mVideoView.start();
This works fine on my tablet running ICS but doesn't seem to work on GoogleTV, is there something I need to do specifically for GTV in this instance?
Logcat output:
04-30 14:03:41.212: D/MediaPlayer(1132): Couldn't open file on client side, trying server side
04-30 14:03:41.308: D/dalvikvm(1132): GC_CONCURRENT freed 862K, 13% free 8303K/9479K, paused 0ms+2ms
04-30 14:03:51.920: E/MediaPlayer(1132): error (1, -2147483648)
04-30 14:03:51.920: E/MediaPlayer(1132): Error (1,-2147483648)
04-30 14:03:51.920: D/VideoView(1132): Error: 1,-2147483648
I verified that VideoView playing YouTube RTSP video works on Google TV:
String vURL = "rtsp://v5.cache1.c.youtube.com/CjYLENy73wIaLQnhycnrJQ8qmRMYESARFEIJbXYtZ29vZ2xlSARSBXdhdGNoYPj_hYjnq6uUTQw=/0/0/0/video.3gp";
mVideoView = (VideoView)this.findViewById(R.id.myvideoview);
mVideoView.setVideoURI(Uri.parse(vURL));
final MediaController mediaController = new MediaController(this);
mVideoView.setMediaController(mediaController);
mVideoView.requestFocus();
mVideoView.start();
Only thing I changed was parsing a different URL. Try this working URL in your code then.

Categories

Resources