media-player

Playing Audio with J2ME

只愿长相守 提交于 2019-11-27 23:15:55
What is the best way to play audio utilzing the J2ME Media libary? For example, should I make use of the MMAPI or should I just use the Midlet's platformRequest(String s) method? The following code should work for 90-95% of handsets out there that support JSR-135. Ordering of all the various method calls is key for this to be portable. This is for sounds local to your JAR. Any streamed audio would be another problem altogether :) // loads the InputStream for the sound InputStream inputStream = this.getClass().getResourceAsStream( musicFile ); // create the standard Player musicPlayer = Manager

Receive OS level key-press events in C# application

狂风中的少年 提交于 2019-11-27 23:06:41
i dont know a better title for the question , but i`ll illustrate my problem. I am working on application that acts like a mp3 player , it uses the Multimedia keys to play/pause , stop the song , i actually made it work but the FormApplication must be in the top [Focused] protected override void WndProc(ref Message msg) { if (msg.Msg == 0x319) // WM_APPCOMMAND message { // extract cmd from LPARAM (as GET_APPCOMMAND_LPARAM macro does) int cmd = (int)((uint)msg.LParam >> 16 & ~0xf000); switch (cmd) { case 13: // APPCOMMAND_MEDIA_STOP constant MessageBox.Show("Stop"); break; case 14: //

Sorry, this video is not valid for streaming to this device in Http streaming android

与世无争的帅哥 提交于 2019-11-27 22:37:45
I can stream some videos from URL (server) successfully, But the others (my video up to my server) is not . You can see both in my code (Working/Not working) I'm on stuck with this problem. "Sorry, this video is not valid for streaming to this device" The following code : String url = null; // url = "rtsp://v5.cache5.c.youtube.com/CiILENy73wIaGQmC00ZlwwIDOxMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp"; // Working // url = "http://daily3gp.com/vids/747.3gp"; // Working url = "http://www.ooklnet.com/files/381/381489/video.mp4"; // Working // url = "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov";

Android playing resource files from internal storage causes MediaPlayer.prepare to give IOException

喜夏-厌秋 提交于 2019-11-27 22:22:40
My app plays audio resource files from the internal directory designated for my app (/data/data/com...). It seems to download the files to that location okay, setDataSource(String path) doesn't throw any exceptions, but MediaPlayer.prepare() throws IOException.The same code works on the SD card. Why is this happening? EDIT: Let's assume this is the code; it's simpler than my code and it throws the same exception: package com.app.MediaPlayerTest; public class MediaTest extends Activity { MediaPlayer mp; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

MediaPlayer stop playing after about 5 seconds

家住魔仙堡 提交于 2019-11-27 22:13:02
I'm currently developing a simple game and now it's time to add music and sound effect. I tried using MediaPlayer , just like described here: Android media player bug However I have another problem, the MediaPlayer stop playing the music after about 5 seconds. What is probable causing this? I had this problem too. It was probably due to having the MediaPlayer-object only existing within a method. For example: //ERROR, stops after 5 sec! public static void playMusic(int id) { MediaPlayer mediaPlayer = MediaPlayer.create(context, id); mediaPlayer.setLooping(true); mediaPlayer.start(); } It is

Listener (or handler) for video finish

旧巷老猫 提交于 2019-11-27 21:48:17
I have implement the following code in order to test playing a video from a remote web server through it´s URL. videoView = (VideoView)this.findViewById(R.id.videoView); MediaController mc = new MediaController(this); videoView.setMediaController(mc); videoView.setVideoURI(Uri.parse("http://sayedhashimi.com/downloads/android/movie.mp4")); videoView.requestFocus(); The code is working just fine, even in the Android emulator. I just would like to know if there's any listener (or handler) to detect the finish of the video that is being reproduced? Update: I have the following code now: @Override

In Android, control (play/pause) media player from external code

一笑奈何 提交于 2019-11-27 21:21:45
问题 I'm very new to Android programming. As a first hobby project, I'd like to write a program to control the media player app, in particular play/pause (or toggle) or even better, fast forward/backward. Is it possible to do this? If yes, are there any tutorials or sample code? Thanks very much. Clarification: maybe I was not clear enough in my original question. I don't want to play audio/video inside my app, but I want to control other media player apps (says the default music app) from my app.

How to get Sampling rate and frequency of music file (MP3) in android?

僤鯓⒐⒋嵵緔 提交于 2019-11-27 20:45:30
I am developing audio player in android. So i want to add the details of the playing song i.e. Artist Name, Duration, Bit rate and sampling frequency. I can get Artist Name and duration of a music file by using MediaStore.Audio.Media library . But i am unable to get Bit rate and sampling frequency of the same file. So how can i get the same? As i know, it can be done by using native library. But don't know how? So anyone can help me on this? You can approximate it by dividing the file size by the length of the audio in seconds, for instance, from a random AAC encoded M4A in my library: File

Exception when calling setDataSource(FileDescriptor) method (failed.: status=0x80000000)

流过昼夜 提交于 2019-11-27 20:25:45
I'm developing a video streaming application and I'm getting stuck when calling set setDataSource with a FileDescriptor. I want my application to play the video as it is being downloaded, so once I get a minimum number of bytes, I move those bytes to another file so it can be played in another file while it's being downloaded in the original file. So, I check if I can start the media palyer every packet like this: if (mediaPlayer == null) { // Only create the MediaPlayer once we have the minimum // buffered data if (totalKbRead >= INTIAL_KB_BUFFER) { try { startMediaPlayer(); } catch

Displaying Artwork for .MP3 file

梦想与她 提交于 2019-11-27 20:19:00
I am trying to currently display the album artwork for a locally stored .MP3 track in an ImageView. Does anyone know how to fetch this artwork in Swift in order to accomplish this? I have found this solution ( iOS AVFoundation: How do I fetch artwork from an mp3 file? ) but the code is written in Objective C. I simply want to grab the image embedded in my MP3 and display it in my ImageView. I've looked at the API documentation for the MPMediaItemArtwork and found an example that also accomplishes what I am trying to accomplish in Objective C as well here( http://www.codeitive.com/0zHjkUjUWX