android-mediaplayer

Play a specific notification sound

北战南征 提交于 2019-12-11 13:39:41
问题 I've created a dialog for selecting a notification sound for an app. I'm querying the notification sounds by getting a cursor from the RingtoneManager: RingtoneManager manager = new RingtoneManager(this); manager.setType(RingtoneManager.TYPE_NOTIFICATION); Cursor cursor = manager.getCursor(); I then store the full path to it by concatenating the sound path with the name. This works fine when I set the selected sound as the notification sound but I can't get media player to play it on

Appending Two Mp3 files in Android

℡╲_俬逩灬. 提交于 2019-12-11 13:10:58
问题 How can i append two audio files in android. I tried this but it does not work. pls give me a soln.I need to concatenate the files from sdcard that ts A.mp3 and B.mp3 .When i merge concatenate method calls i want both of them as a single file in sdcard that is C.mp3........ File original= new File("/mnt/sdcard/A.mp3"); File temp=new File("/mnt/sdcard/B.mp3"); Log.i("...............",""+path); try { File outFile= new File("/mnt/sdcard/C.mp3 "); DataOutputStream out=new DataOutputStream(new

Using Viewpager with MediaPlayer

左心房为你撑大大i 提交于 2019-12-11 12:19:23
问题 I'm trying to use a viewpager with a mediaplayer and i'm running into some issues. My app is set up where you click on a video in the gridview and then when the screen becomes visable it will start playing the video. When I first open up the video it plays fine. The viewpager works for two pages to the left or right. However when I go over that the app freezes up and crashes. I set up some logs and I found in my pageradapater class, right after setPrimaryItem is called there is an

Is it possible to control media player quality?

≯℡__Kan透↙ 提交于 2019-12-11 12:04:02
问题 I download video with: mPlayer.setDataSource("https://s3-eu-west-1.amazonaws.com/ellovidsout/1232/9/1423065486.mp4.m3u8") Header contains following data: #EXTM3U #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=532000,RESOLUTION=400x224,CODECS="avc1.42001e,mp4a.40.2" 400k_1423065486.mp4.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1273000,RESOLUTION=640x360,CODECS="avc1.4d001f,mp4a.40.2" 1000k_1423065486.mp4.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2476000,RESOLUTION=1024x576,CODECS="avc1

unable to play sound using android MediaPlayer in dialog?

北战南征 提交于 2019-12-11 12:04:00
问题 I'm trying to play sound in a dialog. But somehow, it doesnt work. I'm not sure whether it's because its in a dialog or so. File file = new File(Environment.getExternalStorageDirectory(),"/record"); final String soundUri = file.getAbsolutePath() + "/" +childName; RelativeLayout layout = new RelativeLayout(MLT_File.this); final MediaPlayer mp = MediaPlayer.create(MLT_File.this, Uri.parse(soundUri)); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT

Video does not resume in VideoView

為{幸葍}努か 提交于 2019-12-11 11:53:52
问题 Many posts are there for this issue.But the solutions are available for when the activity gets paused. I tried all it doesn't work. My problem is little bit different I have a videoview and when the user clicks the videoview ,video will be paused and if he clicks again it should be resumed. My code snippet in ontouchlistener is, videopath = getIntent().getStringExtra("path"); imageView = ((VideoView) findViewById(R.id.imageView)); imageView.setVideoPath(videopath); imageView.start();

Why MediaSession not changing the lock screen background (may be Bitmap size problem: read for more info)?

南笙酒味 提交于 2019-12-11 10:38:34
问题 I am stuck in this problem from last 6 days after deep research through media session I found this important line Album artwork for display on the lock screen. The image is a bitmap with a maximum size of 320x320dp (if larger, it's scaled down). Now, Here is my code of media session and Notification... MEDIA SESSION @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) private void initMediaSession() { if (mediaSessionManager != null) return; mediaSessionManager = (android.media.session

Start new stream with AACDecoder

给你一囗甜甜゛ 提交于 2019-12-11 10:08:21
问题 I'm doing a radio Application (Tune In like) The situations : When the radio start at first it play an audio AD and then start the radio (AD and radio are 2 diferents streams) When a AACPlayer is currently playing music and the user change station Two problems : When the ad finish the AACPlayer need to stop and start with another URL When the user select another radio it is the same With the AACDecoder library there are only two methods - start() - stop() Those methods can interfere with each

Android MediaPlayer on ViewPager blocking UI transition and no callback for initial page loads

坚强是说给别人听的谎言 提交于 2019-12-11 10:01:08
问题 Basically, we want to build a paged horizontal scroll view with one video player on each page; Video should auto-play and auto-pause/stop when page focus is changed. So I decided to use a ViewPager to show video Fragments. Each fragment has its own SurfaceView and MediaPlayer for video playing. The goal is to auto-play video when initial page loads and when user swipes to select a new page. I am facing a few issues: I couldn't get callback from ViewPager when initial page is loaded. I’ve try

VideoView with a ListView

三世轮回 提交于 2019-12-11 09:53:32
问题 I am relative new to Android development. I am working on an app where it is a specific client requirement that I have a scrollable list of videos. These videos must be playable within the scrolling list as embedded views. My first thought was to use VideoViews in a ListView and use a custom ArrayAdapter to instantiate the VideoViews. After running this I get all kinds of errors, such as: E/MediaPlayer﹕ error (100, 0) E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.IllegalStateException at