gpt4 book ai didi

javascript - 使用 javascript API 响应内部服务器错误将轨道上传到 SoundCloud

转载 作者:可可西里 更新时间:2023-11-01 13:49:13 28 4
gpt4 key购买 nike

我正在尝试使用以下代码通过 JAVASCRIPT API 将轨道上传到 SoundCloud:

<!DOCTYPE html>
<html>
<head>
<title>Upload track</title>
<script src="https://connect.soundcloud.com/sdk/sdk-3.0.0.js"></script>
<script>
var blob = "MY_BLOB";
SC.initialize({
client_id: 'MY_CLIENT_ID',
oauth_token: 'MY_TOKEN',
refresh_token: 'MY_REFRESH_TOKEN'
});
var upload = SC.upload({
file: blob, // a Blob of your WAV, MP3...
title: 'HTML test',
genre: 'Electronic',
description: 'This is a good! track'
});
</script>
</head>
<body>

</body>
</html>

我从之前的请求中获得了 oauth_tokenrefresh_token。我得到的回应是:

{"errors":[{"error_message":"500 - Internal Server Error"}]}

我以为我的 blob 不正确,但如果我把它放在 audio 标签中:

<audio controls>
<source src="MY_BLOB" type="audio/ogg">
</audio>

并且有效。也就是说 blob 不是问题所在。有什么问题?

最佳答案

你应该按照

<script src="https://connect.soundcloud.com/sdk/sdk-3.0.0.js"></script>
<script>

// When you have recorded a song with the SDK or any Web Audio application,
// you can upload it if it's in a format that is accepted
SC.upload({
file: theBlob, // a Blob of your WAV, MP3...
title: 'This is my sound'
});
</script>

来源 = https://developers.soundcloud.com/docs/api/guide#uploading

关于javascript - 使用 javascript API 响应内部服务器错误将轨道上传到 SoundCloud,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37074679/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com