DRM Videos On VideoView - android

I want to play WVM videos on my Application. I am using WideWine DRM plugin for that.
The Videos getting License successfully and running fine,
But When I move the SeekBar of MediaController from current position to any position, It throws a MediaPlayer error sometime.
The error is like :
MediaPlayer error (260, -2001)
What are the actual cause for this error ?
I have used this code to start video :
wv = new WidevineDrmHandler();
wv.initialize(MainActivity.this);
wv.requireLicence(url, handler2, false);
mVideoView.setVideoURI(Uri.parse(url));
mVideoView.start();

Related

Play a video on Android using a videoview container

Im trying to understand how to add video to my application using the VideoView container but so far I've never been able to view a video and all i receive is an error 'Can't play this video'.
I have a simple method that load's the video:-
private void setupVideo() {
VideoView videoView = (VideoView)findViewById(R.id.videoView);
videoView.setVideoPath("video/Test_Movie.m4v");
videoView.start();
}
I have tried converting the video to many H264, H263 , 3gp formats but I can find anything that works.I even have downloaded a video that said worked in a book i have but still doesn't work.
any help appreciated!
thx.

Video player error playing local videos

I'm trying to create a activity with a Video Player.
The problem is that in some devices (ex. Android 4.0.4) when I try to play local video the VideoView shows LogCat error :
MediaPlayer(6757): Error (1,-2147483648)
And on screen:
"Cannot play video. Sorry, this video cannot be played"
The videos be recorded with MediaRecorder and this is the config of MediaRecorder
public boolean initRecorder(){
myRecorder = new MediaRecorder();
myRecorder.setCamera(myCamera);
myRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
myRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
myRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
myRecorder.setOutputFile(getVideoFilePath()); //videopath.mp4
myRecorder.setVideoSize(size.width, size.height);
myRecorder.setPreviewDisplay(mySurfaceHolder.getSurface());
if(prepareRecorder()) return true;
else return false;
}
And played with VideoView like this:
VideoView vidDisplay = (VideoView) viewLayout.findViewById(R.id.vidDisplay);
Uri uri = Uri.parse(_imagePaths.get(position));
vidDisplay.setVideoURI(uri);
vidDisplay.setMediaController(new MediaController(_activity));
vidDisplay.requestFocus();
vidDisplay.start();
EDIT:
The problem is related to the user permissions of the video. Is there a way to create aguna videos with MediaRecorder with read permissions for everyone?
I tried to open the file and then make setReadable(true) but this not work
Can someone help me?
Thanks

Android Sorry, this video cannot be played

I'm using VideoPlayer in my app. It play everything fine but when I want to scroll on the media player's bar, usually it gives me the error : Sorry, this video cannot be played. and I have to restart the video to watch it again. All I found is if I stop the video and scroll the bar it will be fine. I just wonder how can I fix this problem ? how can I access to media player's bar. Hens I can pause the video onClick. My code:
MediaController mediaController = new MediaController(
rootView.getContext());
mediaController.setAnchorView(video);
Uri uri = Uri.parse(passVideo.file_link);
video.setMediaController(mediaController);
video.setVideoURI(uri);
video.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer arg0) {
mProgress.setVisibility(View.INVISIBLE);
video.requestFocus();
video.start();
}
});
Many people get this error like you,
Bugs :
Sorry this video is not valid for streaming to this device.
Sorry, this video can not be played.
You can find out at Sorry, this video is not valid for streaming to this device in Http streaming android
Thanks,

Issue on Android Video View its not working

I'm playing YouTube from URL, but when I play the video it shows the following error:
unable to open video
I'm using this code:
video =new VideoView(this);
video.setVideoURI(path);
System.out.println("my path"+path);
ctlr = new MediaController(this);
ctlr.setMediaPlayer(video);
video.setMediaController(ctlr);
video.requestFocus();`
The path is correct. I checked on the Web also. Why am I getting an error like that?
The links are like: http://www.youtube.com/v/8B-Vu94Sd4M?f=videos&app=youtube_gdata
You can't simply give the VideoView a Youtube URL and expect it to play the video. This seams to be impossible at all (see here).
However, you might want to use a YouTube Intent and let the System handle it: Link

VideoView on Archos 5 (Android 1.6) doesn't work

I'm developing an app for the Archos 5 Internet Tablet. (With Android 1.6)
I want to start a video in a VideoView within my app. On my Android emulator the following code works fine but on my Archos 5 I always get an error:
Cannot play video
Sorry, this video cannot be played.
//get current window information, and set format, set it up differently, if you need some special effects
getWindow().setFormat(PixelFormat.TRANSLUCENT);
//the VideoView will hold the video
VideoView videoHolder = (VideoView) findViewById(R.id.VideoView01);
//MediaController is the ui control hovering above the video (just like in the default youtube player).
videoHolder.setMediaController(new MediaController(this));
//assing a video file to the video holder
videoHolder.setVideoURI(Uri.parse("android.resource://mypackage/" + R.raw.testmovie));
//get focus, before playing the video.
videoHolder.requestFocus();
if(autoplay){
videoHolder.start();
}
Is there a way to run a VideoView on a archos 5?
I also tried to play the movie with the archos player. With the following code I get the error: "Cannot find the media file!".
String ACTION_LAUNCH_AVOS = "android.intent.action.LAUNCH_AVOS";
String avosCommand = "ACTION:video_play,url=videoentries:Video/testmovie.wmv,etype=resume";
final Intent startAvos = new Intent(ACTION_LAUNCH_AVOS,Uri.parse(avosCommand));
startAvos.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
startActivity(startAvos);
I put the video in the Video folder of the Archos. The video runs when I open it with the file browser.
I always get the error "Cannot find the media file!", no matter what url I use.
Is there a certain folder where I have to put the video so that it can be found? And how do I get the url to that certain folder?
It would be great if you could help me!
Thanks and BR,
Thomas

Categories

Resources