media-player

Stream live video from phone to phone using socket fd

℡╲_俬逩灬. 提交于 2019-12-17 15:18:15
问题 I am new to android programming and have found myself stuck I have been researching various ways to stream live video from phone to phone and seem to have it mostly functional, except of course the most important part: playing the stream. It appears to be sending the stream from one phone, but the second phone is not able to play the stream. Here is the code for the playing side public class VideoPlayback extends Activity implements Callback { MediaPlayer mp; private SurfaceView mPreview;

How to play audio file from raw/assets folder on the native/default media player?

六眼飞鱼酱① 提交于 2019-12-17 13:49:08
问题 I know i can play an mp3 file in the media player like that: Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); File file = new File(YOUR_SONG_URI); intent.setDataAndType(Uri.fromFile(file), "audio/*"); startActivity(intent); Following this link I tried to get the URI like: Uri audio = Uri.parse("android.resource://com.audio.test/"+R.raw.audio1); Log.d(TAG,"uri:"+audio.toString()); and Uri audio = Uri.parse("android.resource://com.audio.test/raw/audio"); Log.d

Playing many different videos on iphone using AVPlayer

雨燕双飞 提交于 2019-12-17 10:47:38
问题 I'm working on a custom video player for iOS using AVFoundation. The idea is to be able to switch to a different video with a gesture (tap, swipe, whatever). Right now the player is working flawlessly on simulator , but when I test it on an actual device, the view goes blank after 3 or 4 swipes. I've even created playback controls for my player, when the view goes blank, these controls load correctly but do nothing. Any ideas guys? This is the initialization for the player - (id

How to play video stream with MPMoviePlayerController in iOS

烈酒焚心 提交于 2019-12-17 10:34:15
问题 I am trying to play a video stream from the internet on the iPhone by pressing a button. I used many code samples but nothing worked. With this code it opens a black view without any video stream or controls in it. (The stream itself works.) NSURL *url = [NSURL URLWithString:@"http://MyStreamURL.com"]; MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish

android mediaRecorder.setAudioSource failed

天大地大妈咪最大 提交于 2019-12-17 07:26:46
问题 I have android G1 firmware 1.6, I am trying to record voice from the app with the follow code. MediaRecorder recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setOutputFile(PATH_NAME); recorder.prepare(); recorder.start(); my manifest.xml has: <uses-permission android:name="android.permission.RECORD_AUDIO" /> I got: 09-23

how to play audio file in android

╄→гoц情女王★ 提交于 2019-12-17 07:17:20
问题 I have a mp3 file in my android mobile, lets it's a xyz.mp3 somewhere in my sdcard. How to play it through my application? 回答1: Simply you can use MediaPlayer and play the audio file. Check out this nice example for playing Audio: public void audioPlayer(String path, String fileName){ //set up MediaPlayer MediaPlayer mp = new MediaPlayer(); try { mp.setDataSource(path + File.separator + fileName); mp.prepare(); mp.start(); } catch (Exception e) { e.printStackTrace(); } } 回答2: @Niranjan, If

Online radio streaming app for Android

点点圈 提交于 2019-12-17 06:22:27
问题 I'm building an Android app that will stream several radio stations from a Latin Country, there is like 10 stations that I know can be played in android, I got the URL's from them and actually made them work using this tutorial (link removed, because it is dead) but the problem I have is that it plays for several seconds and then stops it keeps loading but does not restart the streaming, my questions: If someone has worked with this tutorial can explain me how to make it stream constantly

Online radio streaming app for Android

好久不见. 提交于 2019-12-17 06:21:14
问题 I'm building an Android app that will stream several radio stations from a Latin Country, there is like 10 stations that I know can be played in android, I got the URL's from them and actually made them work using this tutorial (link removed, because it is dead) but the problem I have is that it plays for several seconds and then stops it keeps loading but does not restart the streaming, my questions: If someone has worked with this tutorial can explain me how to make it stream constantly

Android MediaPlayer Problems :“Error (-38 , 0) ” and “stop called in state 1”

自古美人都是妖i 提交于 2019-12-17 06:14:40
问题 It's no sound from my device even the emulator. Actually, at the line "mMediaPlayer.create(this, musicIds[0]); " , eclipse suggests me two choices : "Change access to static using 'MediaPlayer'(declaring type)" or "Add @SuppressWarnings 'static-access' to on Create()" . By the way, I take eclipse's suggestions........but still don't work. P.S. I called a package from other project (pager). public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(R.string

Passing parameters on button action:@selector

久未见 提交于 2019-12-17 05:01:54
问题 I want to pass the movie url from my dynamically generated button to MediaPlayer: [button addTarget:self action:@selector(buttonPressed:) withObject:[speakers_mp4 objectAtIndex:[indexPath row]] forControlEvents:UIControlEventTouchUpInside]; but action:@selector() withObject: does not work? Is there any other solution? Thanks for help! 回答1: Edit. Found a neater way! One argument that the button can receive is (id)sender . This means you can create a new button, inheriting from UIButton, that