media-player

AVPlayer Dynamic Volume control

匆匆过客 提交于 2019-12-05 02:59:22
问题 How can I change the volume of the AVPlayer Dynamically? I mean, I want to mute the volume every time a button is pressed. the given code seems to change it in compile time only. How to do it during runtime??? AVURLAsset *asset = [AVURLAsset URLAssetWithURL:[self myAssetURL] options:nil]; NSArray *audioTracks = [asset tracksWithMediaType:AVMediaTypeAudio]; NSMutableArray *allAudioParams = [NSMutableArray array]; for (AVAssetTrack *track in audioTracks) { AVMutableAudioMixInputParameters

Android Media Recording using threads

坚强是说给别人听的谎言 提交于 2019-12-05 00:54:20
问题 I am developing an android application that simply start and stop recording using Buttons. I used threads. I created three classes.. One to start recording.. one to stop recording and the main class.. The problem is that I can see the file in my mobile but it is empty and the mobile give me a msg "Unable to play video" .. I want it to work with the threads.. I dont want other methods.. This is my code The main class: public class MediaRecorderSampleActivity extends Activity { Button start;

java.io.IOException: setDataSource failed.: status=0x80000000

白昼怎懂夜的黑 提交于 2019-12-04 23:51:18
I am trying to play url using media player in activity using: mediaPlayer = MediaPlayer.create(getApplicationContext(), Uri.parse("http://www.pocketjourney.com/downloads/pj/video/famous.3gp"), holder); It's working fine. Same code I use to set it as an live wallpaper in @onSurfaceCreated in WallpaperService , it's giving me following error log D/MediaPlayer( 4128): create failed: D/MediaPlayer( 4128): java.io.IOException: setDataSource failed.: status=0x80000000 D/MediaPlayer( 4128): at android.media.MediaPlayer._setDataSource(Native Method) D/MediaPlayer( 4128): at android.media.MediaPlayer

Android Media Player Threading

会有一股神秘感。 提交于 2019-12-04 23:45:00
问题 I have written a Music player app and it works great but when a flip action happens or when I return the the player view I have to stop the player and restart it at the postion that it was at when the action happened. That all works but it means a breif stop and start. How can I run the media player in a different thread and still update my seekbar? Thanks 回答1: Try running the media player within a foreground service. It's a little bit of work, but it's how it should be done anyways. The

Develop a custom media player on iPhone

这一生的挚爱 提交于 2019-12-04 22:05:37
I'm interested in developing a Custom Media Player on iPhone. Can you give me a basic idea to start with, i would like to know the libraries / API's which supports to develop my own player. My custom media player has to play from local hard disk, and as well as it has to stream over network. Can you please help me out to give a start in right direction? Thank You in advance. Suse. You should use AVFoundation.Framework , MediaPlayer.Framework . Here are the sample code for, Music player Movie Player 来源: https://stackoverflow.com/questions/4918333/develop-a-custom-media-player-on-iphone

MediaPlayer 'prepare();' problem

久未见 提交于 2019-12-04 21:49:19
When I use prepare(); on my mediaplayer, a black layout pops up till the mediaplayer is prepared.. I want to change that black screens layout, is that possible? prepare(); is a blocking operation, if you dont want to block your UI Thread use prepareAsync(); . Or use prepare in another Thread Do all these thing in background thread until media player instance prepared the resource to play and show progress bar upto that time //progressDialog Thread th=new Thread(new Runnable() { @Override public void run() { MediaPlayer md=new MediaPlayer(); try { md.setDataSource("Path"); md.prepareAsync(); md

Changing data source for audio playback using existing MediaPlayer?

北城余情 提交于 2019-12-04 20:45:28
问题 I'm trying to use the same media player but change the data source. Here is what I'm trying to do: private MediaPlayer mMediaPlayer; public void pickFile1() { initMediaPlayer("myfile1.mp3"); } public void pickFile2() { initMediaPlayer("myfile2.mp3"); } private void initMediaPlayer(String mediafile) { // Setup media player, but don't start until user clicks button! try { if (mMediaPlayer == null) { mMediaPlayer = new MediaPlayer(); } else { mMediaPlayer.reset(); // so can change data source

Android Lock Screen and Keyboard Controls

筅森魡賤 提交于 2019-12-04 20:20:36
I am part way through writing a media player app for Android. It's all going really well so far, however I am now reaching the difficult stage! I have two questions. Do i need to implement a service activity? As I understand it, this is required to allow the app to continue working in the background. However, mine is working fine while I move to other programs on the tablet, and returns to the app without problems. Can someone please explain what the advantages are of services? Secondly, I would like to integrate the media player with the standard lock screen controls in ICS, and also make it

How to stop MediaPlayer stream and then restart it? Android

↘锁芯ラ 提交于 2019-12-04 19:56:30
问题 I am making a simple app to play a online radio stream. I know how to set up the stream. Here is my code so far. It sets up the stream and plays it fine. But if I hit stop, I cannot get it to start again. Am I missing something obvious? final MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); try { mediaPlayer.setDataSource(url); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch

Two Object of media Player not play song in Sync at same time

自作多情 提交于 2019-12-04 19:32:40
I have working on to one android application.Normal concept of this application is to Play Song in Multiple Device at Same Time.Everything is done but Song is not play in Sync.I have done lot's of R&d to solve this problem but not getting success.but at end I have found one Issue of Android Media Player.For finding this issue I have making one demo Application.Description is follow. Demo App Description I create a two object of Android media player firstPlayer and secondPlayer.firstPlayer Song playing will be start once App is Lunch.now i have taking one Button in test.xml.once the User will