带有Android Universal Media Player应用程序的JSON(MediaPlayer错误1) [英] JSON with Android Universal Media Player Application (MediaPlayer Error 1)
问题描述
{Android新手开发.}
{Novice Android Dev.}
我目前正在使用在 Github 上找到的Google开源媒体应用程序来尝试创建我自己的项目之一的媒体播放器.但是,我一直遇到的一个问题是,当我从
I'm currently using Google's Open Source Media App found on Github to try and create my own media player for one of my own projects. However, one issue that I keep running into is that when I change the JSON file in RemoteJSON from
protected static final String CATALOG_URL =
"http://storage.googleapis.com/automotive-media/music.json";
到
protected static final String CATALOG_URL =
"https://api.myjson.com/bins/2ir4d";
(使用myjson.com存储文件)
(using myjson.com to store the file)
它填充信息应用程序内,但在选择一个项目时,它产生一个错误的MediaPlayer 1(-2147483648). (我所做的就是从原始Google URL复制JSON代码并将其上传到myjson)
it populates the information within the app but when one item is selected, it produces a MediaPlayer error 1 (-2147483648). (All I did was copy the JSON code from original Google URL and uploaded it to myjson)
我的目标是使用自己的媒体内容创建自己的JSON文件,但我什至无法在提供的URL之外使用该文件.
My goal is to create my own JSON file with my own media content but I can't even get this one to work outside of the provided URL.
有什么想法吗? 非常有义务
Any ideas? Much obliged
推荐答案
如果查看music.json
的内容,则source
和image
路径是相对路径,存储在http://storage.googleapis.com/automotive-media
目录中.
If you look at the contents of the music.json
, the source
and image
paths are relative paths, stored in the http://storage.googleapis.com/automotive-media
directory.
在您的情况下,没有https://api.myjson.com/bins/Jazz_In_Paris.mp3
,因此播放该曲目的任何尝试显然都会失败.如源代码,只有当值的开头不是http
时,才使用相对的源名称和图像名称逻辑.
In your case, there is no https://api.myjson.com/bins/Jazz_In_Paris.mp3
, so any attempt to play that track will obviously fail. As seen in the source code, the relative source and image name logic is only used when the values do not start with http
.
您可以使用http://storage.googleapis.com/automotive-media/
临时为所有源和图像添加前缀,以重用现有值,直到您托管自己的内容.
You can temporarily prefix all of the sources and images with http://storage.googleapis.com/automotive-media/
to reuse the existing values until you host your own content.
这篇关于带有Android Universal Media Player应用程序的JSON(MediaPlayer错误1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!