shoutcast - 显示直播 v2 流的专辑封面
问题描述
我有一个广播服务器 v2.6 和一个在同一服务器上带有播放器的网站。播放器已从音频流中显示标题和艺术家。使用shoutcast 2 流,我们可以简单地通过这个URL 显示专辑封面: url_of_the_server/playingart?sid=1 (对于流1)但它必须刷新所以,我是一个新手,你能帮我获得一个代码显示此 url 并刷新它而不刷新页面,因此必须在 javascript 或 jquery 中。谢谢
解决方案
这是 Jquery 的示例伪代码
function loadImage(){
$.ajax({
url: 'url_of_the_server/playingart?sid=1',
type: 'get',
success: function(response){
// Display image from response
}
});
}
$(document).ready(function(){
// Run every 5 seconds
setInterval(loadImage, 5000);
});
另一种选择是每 5 秒删除一次图像并用新 URL 替换它
推荐阅读
- vue.js - Vue.js 中的 Chrome 扩展构建未检测到 Vue.js 开发工具
- javascript - 2 不同标签的折线图 | 图表.js
- javascript - 如何将数据从加载到 div 的网页传递到加载它的页面
- laravel - Laravel Eloquent 移除
- javascript - 使用用户 ID 的 Discord.JS 头像命令
- javascript - 在node.js中刷新页面后会话变量未定义
- android - 如何使用 Retrofit 加载更多帖子
- sql - 访问 SQL 中的数组列 - 用于多个值
- python - 如何找到与 cv2 接壤的红色矩形的白色圆形轮廓的中心
- weka - 在 Weka 中运行 CatBoost