0

I'm at wits end with this. I'm doing a contract with a client that uses ASP and am pretty unfamiliar with it. I'm using something called jPlayer for the video functionality. jPlayer will use HTML5 video if it can, and if not it falls back to a Flash plugin. When you setup the player object, you point it to the directory where the Flash player resides.

My problem, after many hours of running around in circles, is that I can't seem to get this path to work when the page is saved as ".aspx" and has the ASPnet features. When I save it as ".html" it works flawlessly. Has anyone ever ran into this issue before? Here's the code that initiates jPlayer:

$(this).siblings('.jPlayer').jPlayer({
    swfPath: "scripts/jQuery.jPlayer.2.2.0/",
    solution: 'flash, html',
    supplied: 'm4v',
    cssSelectorAncestor: "#j_controls_"+cur_ctrl,
    ready: function () {
        $(this).jPlayer("setMedia", {
            m4v: file 
        });                 
        $(this).jPlayer("play");
    },
    wmode: "opaque"
})
4

2 回答 2

0

将 aspx 文件视为对服务器的指令,而不是对客户端的指令。没有直接的 1:1 映射到最终将发送给客户端的内容。例如,将在 处访问的内容/some/path/with/subdirectories/test.aspx可能与在 处访问的内容完全相同/root/test.aspx

当客户端收到下载指令时script/jPlayer.js,构造的 HTTP 请求将完全不同,具体取决于加载 aspx 的两个地址中的哪一个。

最可靠的方法是从应用程序根目录访问您的文件,即/在路径中使用前导。

如果您无法仅通过查看路径来弄清楚为什么您的脚本没有被加载,请使用您的浏览器检查工具来查看它真正尝试加载资源的路径,以及您在哪里获得 404。

很可能你的 jPlayer 文件加载得很好,但是 jPlayer 脚本又使用相对路径来加载另一个资源,这就是你得到 404 的地方。

于 2012-12-06T15:34:31.777 回答
0

你所有的标记都是纯html吗?或者你正在使用任何 asp 控件?如果你使用这样的控件,你应该警惕这种标记指定的 id 在渲染之前在服务器端被改变。另请注意,您的页面可能包含一个母版页,其中包含各种其他标记和 js。很难告诉你这个小信息有什么问题。

于 2012-12-06T15:33:07.983 回答