JQTouch 无法播放链接的 mp3 文件
我正在尝试使用 JQTouch 制作一个基本的移动网站来播放音频文件列表。我正在尝试制作一个简单的曲目播放列表,用于学校的艺术展览。有点像您可能见过的徒步旅行。当我链接到无序列表中的 mp3 文件时,浏览器不会打开该文件并开始播放。它只是抛出垃圾文本。
这种情况在常规网络浏览器以及我的 iPhone 和 Android 手机中都会发生。如果我将链接目标指定为 _blank ,它将起作用,但会在另一个窗口中打开文件,必须关闭该窗口才能返回到移动站点。我希望用户只需单击链接并让手机开始播放音频。
我尝试使用 HTML5 的音频标签,但无法使其正常工作。玩家不会表现或做类似上述问题的事情。
奇怪的是,点击链接后,浏览器显示该链接是#undefined。
公平地说,我对 Javascript 并不是那么擅长,所以这可能是相当明显的事情,但到目前为止我还是无法理解。感谢您的帮助。
您可以在 http://trinity.edu/rchapman/iphone/ 看到我的模型
I'm trying to use JQTouch to make a basic mobile site to play a list of audio files. I'm trying to make a simple playlist of tracks to be used in an art exhibit here at school. Sort of like those walking tours you may have seen. When I link to an mp3 file in an unordered list the browser doesn't open the file and start playing it. It simply throws up trash text.
This happens both in a regular web browser as well as my iPhone and Android phones. If I specify the link destination as _blank it will work but opens the file in another window which has to be closed to go back to the mobile site. I would prefer for a user to simply click on the link and have the phone start playing the audio.
I tried working with the audio tags for HTML5 but had trouble making them work. The player would not show or did something similar to the problem mentioned above.
What's strange is that after clicking on the link the browser shows me that the link is #undefined.
To be fair I'm not all that great with Javascript so it might be something fairly obvious but so far it eludes me. Thanks for the help.
You can see my mockup at http://trinity.edu/rchapman/iphone/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法直接链接到 HTML 中的 MP3 文件并播放它...您必须在此处执行一些 javascript:
您的脚本部分:
更改
为
:
在
请参阅 音频标签,以及 html5 rock 了解更多详细信息。
You can't link directly to an MP3 file in HTML and have it play... You are going to have to do some javascript here:
In your script section:
change
to
change
to:
See the audio tag, and html5 rocks for more details.