我添加
"sources": <|php echo $file?>
结果
"sources":[{"type": "video/mp4", "label": "HD", "file": "https://video-12345.mp4"}] }],
我想添加下载按钮
function() {
window.location.href = " <|php echo $file?>";
结果
function() {
window.location.href = [{"type": "video/mp4", "label": "HD", "file": "https://video-12345.mp4"}] }],
所以我只想要视频链接? 结果就像这样...
function() {
window.location.href = "https://video-12345.mp4";
所以我想点击一下
进行下载答案 0 :(得分:0)
如果&lt; | php echo $ file?&gt;产生一个值数组,然后......
var data = [{"type": "video/mp4", "label": "HD", "file": "https://video-12345.mp4"}]; // output of <|php echo $file?>
function myFunction() {
window.location.href = data[0]['file']; // first item in data array, file property value
}