我正在使用NanoHTTPD从我的sdcard播放音频文件,它工作正常。
如果我在浏览器中输入http://172.16.6.75:8080,它将开始播放,但我想播放与http://172.16.6.75:8080/test.mp3类似的文件。
希望有人可以在这里帮助我。谢谢!
Well, finally I change serve method to have 2 URLS and distinguish between them:
@Override
public Response serve(String uri, Method method,
Map<String, String> header,
Map<String, String> parameters,
Map<String, String> files) {
if (uri.contains("picture")){
//serve the picture
return new NanoHTTPD.Response(st, mediasend, fisPicture, f.length());
}else if (uri.contains("song")){
//serve the song
return new NanoHTTPD.Response(st, mediasend, fisSong, f.length());
}
Run Code Online (Sandbox Code Playgroud)