i faced some problems when try to view video using VideoView. i always got message Can't play this video after that appears failed to connect
This is my url
rtsp://136.243.10.198:1935/xxx_vod/xx_1455171793.mp4?key=b1fbf3e6e6edcc2bb6c75f879edf8bf0
i got error on Log :
E/MediaPlayer: setDataSource: IOException! uri=rtsp://136.243.10.198:1935/xxx_vod/xx_1455171793.mp4?key=b1fbf3e6e6edcc2bb6c75f879edf8bf0
and
E/MediaPlayer: error (262, -1010)
My Code :
path = getActivity().getIntent().getStringExtra("path");
videoView.setMediaController(new MediaController(getActivity()));
videoView.setVideoPath(path);
videoView.requestFocus();
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
#Override
public void onPrepared(MediaPlayer mediaPlayer) {
mediaPlayer.start();
}
});
Related
I have uploaded a video in my recourses file in android studio and I want to play the video offline in my app my video is of 1 MB but when I run my app it throws an error
error (1, -2147483648)
and a pop up
shows up that Video can not be played.
E/SurfaceSyncer: Failed to find sync for id=0
E/MediaPlayerNative: error (1, -2147483648)
W/Parcel: Expecting binder but got null!
E/MediaPlayer: Error (1, -2147483648)
D/VideoView: Error: 1,-2147483648
This is my Main class code
package com.example.igea;
import...
public class MathsChap1 extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maths_chap1);
Button bb = findViewById(R.id.ibk);
bb.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent i = new Intent( packageContext: MathsChap1.this, Maths.class);
startActivity(i);
}
});
VideoView v1 = findViewById(R.id.vv1);
v1.setVideoPath("android.resources://" + getPackageName() + "/" + R.raw.video1);
MediaController mc = new MediaController( context: this);
v1.setMediaController(mc);
mc.setAnchorView(v1);
v1.start();
}
}
Can someone please help me with this error?
You can use MediaPlayer
MediaPlayer mediaPlayer;
mediaPlayer = MediaPlayer.create(this, R.raw.your_video_file);
mediaPlayer.start();
I am displaying the videos in a list. After playing the videos one after another it is displaying video can't play error in android naught only in Remaining all the versions are working fine.Please help me to resolve this issue. Below is the my code for playing the video in video view.
videoview.setVideoURI(Uri.parse(streamInfo.video_streams.get(0).url));
viewHolder.large_videoview.seekTo(starttime * 1000);
viewHolder.large_videoview.start();
videoview.setOnPreparedListener(new OnPreparedListener() {
// Close the progress bar and play the video
public void onPrepared(MediaPlayer mp) {
mMediaPlayer = mp;
mp.setOnInfoListener(new MediaPlayer.OnInfoListener() {
#Override
public boolean onInfo(MediaPlayer mp, int what, int extra) {
Log.e("large_videoview", "<><>onInfo");
if (what == MediaPlayer.MEDIA_INFO_BUFFERING_START)
//Log.e("buffering starts", "buffering starts");
if (what == MediaPlayer.MEDIA_INFO_BUFFERING_END)
Log.e("buffering ends", "<><>buffering ends");
return false;
}
});
}
});
getting this error in my log cat
E/MediaPlayer: invoke failed: wrong state 0, mPlayer(0x7a30b0e0)
E/MediaPlayer: Error (1,-19)
E/MediaPlayer: Error (1,-1010)
Are you sure you are doing like this?
videoview.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
videoview.start();
}
});
i.e wait for VideoView to be prepared & once it's prepared, you call start() on it?
Hi we have an app in the playstore that has a module that play a stream from an url, the app works fine and we make a yearly release, but now that we are making changes, the part of the radio does not work, in any device.
Basically my code is
mediaPlayer = new MediaPlayer();
try {
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource("http://radio.promosat.com:8104/");
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
#Override
public void onPrepared(MediaPlayer mp) {
mp.start();
}
});
mediaPlayer.prepareAsync();
}catch (Exception ex){
ex.printStackTrace();
}
I keep getting this error
E/MediaPlayer: Error (1,-2147483648)
This worked perfectly, the url that we use it's in the example code, it uses a pls file, that's where we obtained the stream url.
The error was the encoding of the stream...aacp is not supported in Android.
I load a .mp4 on a VideoView, all things go fine until I drag the seekbar point to a new position, so the MediaPlayer starts to buffering and then the app freezes (not crash, just freeze) with an error message:
"Can't play video"
This is the code:
try {
// Start the MediaController
controller.setAnchorView(videoView);
// Get the URL from String VideoURL
Uri video = Uri.parse(getIntent().getExtras().getString("video"));
videoView.setMediaController(controller);
videoView.setVideoURI(video);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
videoView.requestFocus();
videoView.setOnPreparedListener(new OnPreparedListener() {
// Close the progress bar and play the video
public void onPrepared(MediaPlayer mp) {
pDialog.dismiss();
videoView.start();
}
});
No errors if I seek an already-buffered position. Only with no-buffered positions.
Error log:
Attempt to perform seekTo in wrong state: mPlayer=0x5c149090, mCurrentState=0
E/MediaPlayer(17339): error (1, -110)
E/MediaPlayer(17339): Error (1,-110)
D/VideoView(17339): Error: 1,-110
Hi there I'm working in my android app to run video from my local server XAMPP and I have placed my video in htdocs folder under my XAMPP server folder and I got this piece of code :
this is the .java file code
public class video extends Activity {
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.video1);
final VideoView vv = (VideoView) findViewById(R.id.vview);
MediaController mc = new MediaController(this);
vv.setMediaController(new MediaController(this));
vv.setVideoURI(Uri.parse("http://10.0.2.2/abc.MP4"));
vv.requestFocus();
vv.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
vv.start();
}
});
}
}
and here's my logcat errors
03-02 02:12:29.222: E/MediaPlayer(464): error (1, -2147483648)
03-02 02:12:29.242: E/MediaPlayer(464): start called in state 0
03-02 02:12:29.242: E/MediaPlayer(464): error (-38, 0)
03-02 02:12:29.252: E/MediaPlayer(464): Attempt to call getDuration without a valid mediaplayer
03-02 02:12:29.252: E/MediaPlayer(464): error (-38, 0)
03-02 02:12:29.322: E/MediaPlayer(464): Error (1,-2147483648)
03-02 02:12:29.742: E/MediaPlayer(464): Error (-38,0)
03-02 02:12:30.222: E/MediaPlayer(464): Error (-38,0)
When I click the button to direct me to video view layout where I should see my video playing I got a "black" blank screen for a moment then the screen changes to a white color for the lower have and black for the upper after that I receive the "this video can't be played" error msg three of them together