Safari Mobile 上的 Soundcloud 流 [英] Soundcloud Streaming on Safari Mobile

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

问题描述

我尝试使用 Soundcloud API 中的这个片段:

I tried to use this snippet from the Soundcloud API:

<script src="http://connect.soundcloud.com/sdk.js">
<script>
SC.initialize({
client_id: 'YOUR_CLIENT_ID'
});

# stream track id 293
SC.stream("/tracks/293", function(sound){
 sound.play();
});
</script>

它适用于除 Safari 移动版之外的任何浏览器,包括 iPhone 和 iPad,在这些浏览器中根本无法播放音乐流.

It works in any browsers aside from Safari mobile, both on iPhone and iPad, where the music stream does not play at all.

我做错了什么?(我用我自己的详细信息替换了轨道 ID 和客户端 ID)

What am I doing wrong? (I replaced track id and client id with my own details)

谢谢

推荐答案

在移动 safari 中,播放有一个限制,即音频播放必须由用户操作触发.因此,您必须添加某种按钮或链接,点击后会调用 sound.play() 函数.

In mobile safari the play has the restriction that audio playback has to be triggered by a user action. So you'll have to add some sort of button or link which when clicked will call the sound.play() function.

这篇关于Safari Mobile 上的 Soundcloud 流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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