音乐背景 [英] Music in background

查看:107
本文介绍了音乐背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁做我创建播放音乐在通话背景上的应用程序,可闻到只有调用者和听者?任何机构可以建议做这件事的方法?我曾试图创建一个用于为应用程序创建的后台服务,音乐服务,但它不能完全满足我的目标。

Who do I create an app that plays music in background of a call, audible to only the caller and the listener? Can any body suggest a method for doing it? I had tried to create a music service which is used for creating background service for apps, but it is not fully satisfying my goals.

我按照这个的链接

编辑:IDEA ---想在通话的背景是听得见的调用者和听众播放音乐时的状态为摘机

IDEA---want to play a music in the background of a call which is audible to the caller and listener when the state is offhook

推荐答案

如果您想要播放的背景音乐为您的应用程序,然后从你的应用程序/应用的AsyncTask类来为你做它启动一个线程进行播放。

If you want to play background music for your app , then play it in a thread launched from your app/use AsyncTask class to do it for you.

 public class BackgroundSound extends AsyncTask<Void, Void, Void> {

@Override
protected Void doInBackground(Void... params) {
    MediaPlayer player = MediaPlayer.create(YourActivity.this, R.raw.test_cbr); 
    player.setLooping(true); // Set looping 
    player.setVolume(100,100); 
    player.start(); 

    return null;
}

}

http://stackoverflow.com/a/7928911/1697047 了解更多详情

这篇关于音乐背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆