media-player

How to play a video file from SD card

对着背影说爱祢 提交于 2019-12-26 15:22:01
问题 I want to play a video file on android emulator that I have stored in sd card. This is my code.. public class AndroidVideoViewActivity extends Activity { private VideoView videoView=null; private String PATH="mnt/sdcard/bmxskills.3gp"; private MediaPlayer mediaPlayer=null; private MediaController mediaController=null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); VideoView videoView=(VideoView)findViewById(R.id

How to sync ui to full screen or compact mode using MediaPlayerElement

会有一股神秘感。 提交于 2019-12-25 18:43:51
问题 I'm using MediaPlayerElement , when my app window in normal size, I have a Button and a TextBox on the MediaPlayerElement . But when I click fullscreen or compact button to enter fullscreen or compact mode, they disappeared. How to show them in full screen or compact mode? A helpfull repo is here, sync the TextBox to fullscreen. 回答1: For your requirement, you could custom your MediaTransportControls and found ControlPanel_ControlPanelVisibilityStates_Border in the style. Then add your element

How to synchronise an asynchronous operation?

不羁岁月 提交于 2019-12-25 12:13:32
问题 I have been looking around in this forum as well as in MSDN but I couldn't really find a proper solution for my problem. Probably my approach is not good. I have the below simple class which has 1 simple method ("PlayAudioFile"). All I want to do is to wait for the playback to complete before letting the method finish and moving on. Since the .Play() is asynchronous, method finishes before playback is completed which is not good for me because I want to playback several files synchronously (1

Using Arabic characters with google TTS API

﹥>﹥吖頭↗ 提交于 2019-12-25 08:55:12
问题 I'm using the google TTS API and I want to make a query in Arabic but keep getting errors and I have set the text file encoding set to UTF-8, here is my code String oLanguage = "ar"; MediaPlayer player = new MediaPlayer(); String mainText = "الله"; try { player.setAudioStreamType(AudioManager.STREAM_MUSIC); player.setDataSource("http://translate.google.com/translate_tts?tl=" + oLanguage + "&q=" + mainText); player.prepare(); player.start(); } catch (Exception e) { // TODO: handle exception }

Android: Mediaplayer plays multiple times if I keep on pressing the back button and launch the app again

荒凉一梦 提交于 2019-12-25 08:33:59
问题 When I play my song and press the back button to return to return to home, the music continues playing. When I launch the app again, the music plays twice. I think it's the onResume method because I commented out the method and the problem stopped. How do I get onResume work properly? I tried using if(backgroundMusic.isplaying()) inside the onResume, but the app crashes when I resume from another activity. What am I doing wrong? //global mediaplayer MediaPlayer backgroundMusic; /** Called

Android app force closes when playing next song in array list

与世无争的帅哥 提交于 2019-12-25 07:29:02
问题 I'm creating an android app (for my own use) that lets me listen to my favourite songs from GTA V. Media Player streams the mp3 tracks from my dropbox account and all this works fine. The problem is that after the first song finishes I want it to play the next song however when I run the app after the first song finishes playing the app crashes instead of playing the next song in the list. Can somebody help me fix this issue i'm having? thanks. Code public class channelx extends Activity

Wpf UserControl with its own data context and external dependency property

好久不见. 提交于 2019-12-25 04:45:30
问题 I'm trying to create a simple AudioPlayer control multiple reuse in a solution I'm working on. I have seen numerous example in various posts and blogs around the net and from those have created a small control with four buttons. The xaml is defined thus: <UserControl x:Class="AudioPlayer" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http:/

How to stop a streaming mp3-file

a 夏天 提交于 2019-12-25 04:19:38
问题 I have build an app that use mp3-files. In the first version the files was included in the apk-file. I now are working on a version that have the mp3-files in an URL-resource. I have adjust the code and almost everything works fine. The problem is that the buttons for stop, pause and play now not is working. This is the code that start the streaming (works fine): private void playAudio(String media) { MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager

Get current frame from android mediaplayer

拥有回忆 提交于 2019-12-25 03:40:41
问题 Is there a way to retrieve the current frame played from android MediaPlayer object? 回答1: No. The media player just setups a pipeline that is handled by lower level components. And depending on the hardware platform and the decoder setup the rendering is done in different places. 回答2: This is a pretty heavy undertaking, involving Android NDK development using something like ffmpeg and glbuffer. You could also bypass OpenGL and just write the ffmpeg-decoded frame to a bitmap in memory. For

MediaPlaying seeking UI lag

大憨熊 提交于 2019-12-25 03:23:45
问题 I have made a VideoPlayer using MediaPlayer which renders on surfaceView. For controls I am using "VideoControllerView". The problem is when I seek the progressbar, the UI becomes unresponsive and I get ANRs . As far as my knowledge is, nothing heavy is running on UI thread unless MediaPlayer updates/renders surfaceView on UI thread, in that case seeking might cause this issue. What factor here contributes to unresponsive UI on seeking? And how to check what is running on UI thread? public