首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JPlayer setMedia mp3

JPlayer setMedia mp3
EN

Stack Overflow用户
提问于 2016-07-19 15:23:06
回答 1查看 111关注 0票数 0

我正在尝试用下面的代码在我的JPlayer中设置mp3声音:

代码语言:javascript
复制
$("#jquery_jplayer_2").jPlayer({
    ready: function () {
        $(this).jPlayer("setMedia", {
            title: "welcome",
            mp3: "C:\Users\test\Desktop\test.mp3"
        });
    },
    cssSelectorAncestor: "#jp_container_2",
    swfPath: "/js",
    supplied: "mp3",
    useStateClassSkin: true,
    autoBlur: false,
    smoothPlayBar: true,
    keyEnabled: true,
    remainingDuration: true,
    toggleDuration: true,
    error: function (event) {
        if (event.jPlayer.error.type === $.jPlayer.error.URL) {
            alert("Not found");
        }
    }
});

当我知道mp3的位置是正确的时候,它会在窗口中显示“找不到”。

EN

回答 1

Stack Overflow用户

发布于 2016-07-19 18:01:44

就在最近面临着这个问题。您的代码将无法工作,因为jplayer不能从文件系统访问文件。

你需要使用某种web服务器(如nginx)来提供你的媒体文件,或者在控制器中使用一种方法来读取文件并返回流。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38451960

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档