视频.mp4,.flv,.swf格式无法播放但下载

时间:2013-09-19 07:15:32

标签: video download playing

我正在使用第三方为网站提供头部服务。下面的javascript确实让说话的头部出现在wordpress网站的主页上。

 <script type="text/javascript" src="http://localhost:8080/wordpress-flash/wp-content/uploads/2013/09/wthvideo/wthvideo.js"></script>

问题: 1.而不是播放说话头,下载.swf格式的视频。 2.使用chrome工作但是如果我们点击它开始以.mp4格式下载的播放按钮,它会在播放剩余的浏览器时消失。

查询

  1. 导致下载而非播放的问题可能是什么?

  2. 如果必须处理.swf或.flv或.mp4的MIME类型,那么如何在wamp localhost和实时服务器上启用它?

  3. 以下是用于播放视频的库代码,该代码将包含在上述javascript中。

    // JavaScript Document
    if (typeof wthvideo == "undefined") {
        wthvideo = new Object();
    }
    wthvideo.params = {
        width:200,
        height:416,
        position:"fixed",
        doctype:"strict",
        left:"auto",
        right:"0px",
        top:"auto",
        bottom:"0px",
        centeroffset:"auto",
        color:0xCCCCCC,
        volume:70,
        autostart:"yes",
        fadein:0,
        fadeout:2,
        flip:"no",
        delay:0,
        delayclose:0,
        buffertime:3,
        controlbar:"mouse",
        exitbtn:"no",
        playbtn:"PlayVideo.png",
        playposition:"center",
        playtop:"bottom",
        exitoncomplete:"yes",
        oncepersession:"yes",
        vidlink:"no",
        openin:"_blank",
        path:"wthvideo",
        actorpic:"katiebankforeclosureschicago.png",
        flv:"katiebankforeclosureschicago.flv",
        h264:"katiebankforeclosureschicagoipad.mp4"};
    
    var topPx = parseFloat(wthvideo.params.top);
    var bottomPx = parseFloat(wthvideo.params.bottom);
    
    wthvideo.hideDiv = function(){
        document.getElementById('wthvideo').style.visibility = 'hidden';
    }
    function onlyOnce() {
    if (document.cookie.indexOf("hasSeen=true") == -1) {
    var later = new Date();
    later.setFullYear(later.getFullYear()+10);
    document.cookie = 'hasSeen=true;path=/;';
    wthvideo.drawVideo();
    }
    }
    function onlyOnce2() {
    if (document.cookie.indexOf("hasSeen=true") == -1) {
    var later = new Date();
    later.setFullYear(later.getFullYear()+10);
    document.cookie = 'hasSeen=true;path=/;';
    wthvideo.drawVideo();
    }
    }
    var btnTop = (wthvideo.params.height)-(122);
    var btnLeft = (wthvideo.params.width/2)-(51);
    wthvideo.drawVideo= function(){
        var markUp = '';
        markUp += '<style type="text/css">';
        markUp += '#wthvideo {position:'+wthvideo.params.position+';width:'+wthvideo.params.width+'px;height:'+wthvideo.params.height+'px;margin-left:'+wthvideo.params.centeroffset+';left:'+wthvideo.params.left+';right:'+wthvideo.params.right+';top:'+wthvideo.params.top+';bottom:'+wthvideo.params.bottom+';z-index:99999;cursor: pointer;}';
        markUp +=  '#wthvideo img{opacity:\1;padding-top:'+btnTop+'px;;padding-left:'+btnLeft+'px;border-style: none;opacity:1;}'; 
        markUp +=  '#wthvideo img:hover{opacity:0.9;}'; 
        markUp +=  '#wthvideo div{background-image:url("'+wthvideo.params.path+'/'+wthvideo.params.actorpic+'")';
        markUp += '</style>';
        markUp += '<div id="wthvideo">';
        markUp += '  <object id="objvideo" style="outline:none;" type="application/x-shockwave-flash" width="'+wthvideo.params.width+'" height="'+wthvideo.params.height+'" data="'+wthvideo.params.path+'/wthplayer.swf">';
        markUp += '    <param name="movie" value="'+wthvideo.params.path+'/wthplayer.swf" />';
        markUp += '    <param name="quality" value="high" />';
        markUp += '    <param name="flashvars" value="vurl='+wthvideo.params.flv+'&amp;vwidth='+wthvideo.params.width+'&amp;vheight='+wthvideo.params.height+'&amp;actorpic='+wthvideo.params.path+'/'+wthvideo.params.actorpic+'&amp;autostart='+wthvideo.params.autostart+'&amp;exitoncomplete='+wthvideo.params.exitoncomplete+'&amp;vbuff='+wthvideo.params.buffertime+'&amp;vdelay='+wthvideo.params.delay+'&amp;vcolor='+wthvideo.params.color+'&amp;vlink='+wthvideo.params.vidlink+'&amp;openin='+wthvideo.params.openin+'&amp;delayclose='+wthvideo.params.delayclose+'&amp;fadein='+wthvideo.params.fadein+'&amp;fadeout='+wthvideo.params.fadeout+'&amp;vvol='+wthvideo.params.volume+'&amp;playbtn='+wthvideo.params.path+'/'+wthvideo.params.playbtn+'&amp;playpos='+wthvideo.params.playposition+'&amp;playtop='+wthvideo.params.playtop+'&amp;hflip='+wthvideo.params.flip+'&amp;controlbar='+wthvideo.params.controlbar+'&amp;exitbtn='+wthvideo.params.exitbtn+'" />';
        markUp += '    <param name="wmode" value="transparent" />';
        markUp += '    <param name="allowscriptaccess" value="always" />';
        markUp += '    <param name="swfversion" value="9.0.45.0" />';
        markUp +=  '    <div>';
        markUp +=  '<a href="'+wthvideo.params.path+'/'+wthvideo.params.h264+'"><img src="'+wthvideo.params.path+'/'+wthvideo.params.playbtn+'" alt="Click to Play" width="103" height="122" /></a>';
        markUp +=  '       </div>';
        markUp += '  </object>';
        markUp += '</div>';
        if (wthvideo.params.position == "fixed") {
            if (wthvideo.params.doctype == "quirks") {
                if (wthvideo.params.top == "auto") {
                            markUp += '<!--[if IE]>';
                            markUp += '<style type="text/css">';
                            markUp += '#wthvideo {position:absolute; top: expression(offsetParent.scrollTop - 1 + (offsetParent.clientHeight-this.clientHeight) + '+bottomPx+' + "px")}';
                            markUp += '</style>';
                            markUp += '<![endif]-->';}
                        else {
                                markUp += '<!--[if IE]>';
                                markUp += '<style type="text/css">';
                                markUp += '#wthvideo {position: absolute !important;top: expression(((document.documentElement.scrollTop || document.body.scrollTop) + (!this.offsetHeight && 0)) + '+topPx+' + "px")';
                                markUp += '</style>';
                                markUp += '<![endif]-->';}
                        }
                    else {
                            markUp += '<!--[if lte IE 6]>';
                            markUp += '<style type="text/css">';
                            markUp += 'html, body{height: 100%;overflow: auto;}#wthvideo {position: absolute;}';
                            markUp += '</style>';
                            markUp += '<![endif]-->';
                }
            }
    
    
    document.write(markUp);
    
    
    }
    function hideDiv() {
        wthvideo.hideDiv();
    }
    
    if (wthvideo.params.autostart=="oncethenpic") {
        if (document.cookie.indexOf("hasSeen=true") == -1) {
            var later = new Date();
            later.setFullYear(later.getFullYear()+10);
            document.cookie = 'hasSeen=true;path=/;';
            wthvideo.params.autostart = "yes";
            }
        else {
            wthvideo.params.autostart = "no";
    
        }
    }
    
    if (wthvideo.params.autostart=="oncethenmute") {
        if (document.cookie.indexOf("hasSeen=true") == -1) {
            var later = new Date();
            later.setFullYear(later.getFullYear()+10);
            document.cookie = 'hasSeen=true;path=/;';
            wthvideo.params.autostart = "yes";
            }
        else {
            wthvideo.params.autostart = "mute";
        }
    }
    
    if (wthvideo.params.autostart=="onceonly") {
        if (document.cookie.indexOf("hasSeen=true") == -1) {
            var later = new Date();
            later.setFullYear(later.getFullYear()+10);
            document.cookie = 'hasSeen=true;expires='+later.toGMTString();
            wthvideo.params.autostart = "yes";
            }
        else {
            wthvideo.params.autostart = "mute";
        }
    }
    
    if (wthvideo.params.autostart=="onceonlythenmute") {
        if (document.cookie.indexOf("hasSeen=true") == -1) {
            var later = new Date();
            later.setFullYear(later.getFullYear()+10);
            document.cookie = 'hasSeen=true;expires='+later.toGMTString();
            wthvideo.params.autostart = "yes";
            }
        else {
            wthvideo.params.autostart = "mute";
        }
    }
    if (wthvideo.params.autostart=="onceonlythenpic") {
        if (document.cookie.indexOf("hasSeen=true") == -1) {
            var later = new Date();
            later.setFullYear(later.getFullYear()+10);
            document.cookie = 'hasSeen=true;expires='+later.toGMTString();
            wthvideo.params.autostart = "yes";
            }
        else {
            wthvideo.params.autostart = "no";
    
        }
    }
    
    if (wthvideo.params.oncepersession == "yes") {
        onlyOnce();}
        else {
            if (wthvideo.params.oncepersession == "onceonly") {
                onlyOnce2();}
            else {
            wthvideo.drawVideo();
        }
        }
    
    
    function thisMovie(movieName) {
             if (navigator.appName.indexOf("Microsoft") != -1) {
                 return window[movieName];
             } else {
                 return document[movieName];
             }
         }
    
    function exitWTH() {
        thisMovie('objvideo').exitVideoWTH();
    }
    function pauseWTH() {
        thisMovie('objvideo').pauseVideoWTH();
    }
    
    function unpauseWTH() {
        thisMovie('objvideo').unpauseVideoWTH();
    }
    function playWTH() {
        thisMovie('objvideo').playVideoWTH();
    }
    function stopWTH() {
        thisMovie('objvideo').stopVideoWTH();
    }
    function muteWTH() {
        thisMovie('objvideo').muteVolWTH();
    }
    function unmuteWTH() {
        thisMovie('objvideo').startVolWTH();
    }
    

1 个答案:

答案 0 :(得分:1)

.fv,.mp4和.swf未找到或只是下载而不是播放视频,然后检查您的浏览器是否安装了Adobe Flash播放器。如果安装它应该播放网站说话头。

相关问题