Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to play a mp3 file directly. #24

Open
JohnnySung opened this issue Oct 1, 2014 · 1 comment
Open

How to play a mp3 file directly. #24

JohnnySung opened this issue Oct 1, 2014 · 1 comment

Comments

@JohnnySung
Copy link

I don't need SoundService, I just want to play a mp3 file from a path.
I don't know how to play. so I build a project, in my main activity, when I click the button, I try to write a program in this way:

Track track;
File tmpFile;
public void btnPlayClicked(View v) {// I can break and step the following program.
track=new Track(this,null);//just guess
track.setDataSourceString(tmpFile.getAbsolutePath());
// track.prepare();//fail so comment out.
track.start();
track.decode();//no thing happen
}

Can you tell me how to do?

@PaulWoitaschek
Copy link

I guess the tmpFile does not exist?
after setDataSource and prepare start should work. Whats the exception that was thrown?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants