android-mediaplayer

Error in opening streaming video

只谈情不闲聊 提交于 2019-12-12 11:35:01
问题 I'm trying to open video stream by giving the url of the video. I'm using VideoView .Here is my code: public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); VideoView videoView = (VideoView) findViewById(R.id.stream_video_view); videoView.setVisibility(View.VISIBLE); MediaController mc = new MediaController(this); mc.setAnchorView(videoView); mc.setMediaPlayer

java.io.IOException: setDataSource failed when play recorded mp4

点点圈 提交于 2019-12-12 10:55:40
问题 I want to play recorded mp4 data using Android Media Player,but when try to play this error showed : java.io.IOException: setDataSource failed. at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1086) at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1032) This is my code : final ImageView play = (ImageView) root.findViewById(R.id.voice_play); play.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { player = new MediaPlayer(); if (player

how to refresh view of previous item row view of recycle view

会有一股神秘感。 提交于 2019-12-12 10:53:48
问题 Hello guys hope you all are fine. I'm Developing an android app which will play different sounds of animals. I'm using Recycle View as you can see in the screenshot below. Now I'm facing a problem, I have a play button inside my row which is playing the sound of the animal whenever I play sound from my item 0 or any position it shows me pause option inside view. But whenever I click on next item 1 or any other it's not changing the image of previous item 0. I'm doing it by refreshing my list

How to catch an Exception if the Internet or Signal is down

筅森魡賤 提交于 2019-12-12 10:53:15
问题 i am working with mediaplayer and streaming audio and i am wondering what is the best way to catch an excpetion if the internet or signal is down and can not stream anymore audio. below is my code that i have done so far, as you can see i am throwing all the excpetion with same message. private class taskDoSomething extends AsyncTask<Void, Void, List<Employee>> { @Override protected List<Employee> doInBackground(Void... params) { String url = "http://ofertaweb.ro/android/sleepandlovemusic

Detecting when a YouTube video has finished playing

假装没事ソ 提交于 2019-12-12 10:47:03
问题 How to do I check when a YouTube video has finished playing in the official YouTube Android app? In the LogCat I see things such as: VideoStage: MEDIA_PLAYING_VIDEO. Is there any way to detect when this finishes? 回答1: You could use MediaPlayer. It has an isPlaying method to check if music/videos are currently playing. Just set a Boolean to true while it's playing and check the isPlaying method against that Boolean to see if it changed from True to False . Otherwise Youtube (or google) may

What is meant by event in Android Media Player?

烈酒焚心 提交于 2019-12-12 10:24:57
问题 I am trying to analyze flow of messages exchanged while playing a video in Android. I came across this image while doing so. http://img521.imageshack.us/img521/3585/capturehb.png Then I went through the source files for AwesomePlayer and TimedEventQueue. I am unable to get what is meant by event in those files. Any help regarding this is appreciated. Thank you. Link for TimedEventQueue source files is attached below. https://github.com/cozybit/aosp-frameworks-base/blob/master/media

Android MediaPlayer: getDuration() returns 0 after prepare()

时间秒杀一切 提交于 2019-12-12 10:22:55
问题 I'm using MediaPlayer on Honeycomb and cannot get the duration of any HLS (http live streaming) video in the function onPrepared(). If getDuration() is called after prepare() , it returns 0: public void onPrepared(MediaPlayer mp) { // getduration returns 0 mediaPlayer.start(); Log.d(TAG, "duration: " + mediaPlayer.getDuration()); } However, the videos starts playing. If getDuration() is called in onVideoSizeChanged() it returns the correct value, public void onVideoSizeChanged(MediaPlayer mp,

android vitamio multiple videoview error

拈花ヽ惹草 提交于 2019-12-12 10:13:01
问题 I edit VideoViewDemo because I need two (or more) stream rtsp in same layout. I use a relative layout with two VideoView and add code in VideoViewDemo to fill each surface. Result is that two video is overlapping each other and logcat give me many times this error : E/SurfaceTextureClient(4717): Surface::lock failed, already locked 01-15 17:41:07.328: E/VitamioPlayer: LOCK BUFFER FAILED E/SurfaceTexture(144): [SurfaceView] dequeueBuffer: can’t dequeue multiple buffers without setting the

Android browser media player (stagefright?) displayed media name

与世无争的帅哥 提交于 2019-12-12 09:49:16
问题 When the Android browser opens a media file it can play, the built-in (stagefright?) media player opens up to stream it. A title for this media is displayed on the player dialog, based on the URL. The URL in this case was http://10.0.37.195/waug_mp3_128k . The media player simply uses the last part of the path as its title. Is it possible to change the displayed title? I have tried a Content-Disposition header, but it had no effect: Content-Disposition: inline; filename=Some Better Title 回答1:

MediaPlayer.seekTo() not seeking to position on Android

假如想象 提交于 2019-12-12 09:38:31
问题 I'm working on an app in which the video is paused at 3 different intervals. After the second pause, if a button is clicked, it should start back from the previous location. Eg. if it is currently paused at 1:30, then on click of a button, it goes to the previous bookmark, i.e. 00:45. I thought using MediaPlayer.seekTo() will help me achieve this. But, seekTo() doesn't seek the position at all. The currentPosition stays the same even after a call to seekTo(); Here's my code. mediaPlayer