MVC,Safari HTML5视频无效

时间:2017-12-19 07:08:51

标签: javascript ios asp.net-mvc html5 safari

我有一个类似下面的HTML。我的问题是视频在Safari或ipad上无法正常运行。另一个浏览器正在运行。

<html><head>
    <meta name="viewport" content="width=device-width">
    <meta charset="utf-8">
    <title>PIV</title>

    <style>
    body,html{background:black}
        .video {width: 100%;height:100%;}
        .wrapper{display:table;width:auto;position:relative;width:100%;height:100%;}
        .playpause {background-image:url(http://png-4.findicons.com/files/icons/2315/default_icon/256/media_play_pause_resume.png);background-repeat:no-repeat;
            width:60px;height:60px;position:absolute;left:0%;right:0%;top:0%;bottom:0%;margin:auto;background-size:contain;background-position: center;display:none
        }
    </style>
</head>
<body>

    <div class="wrapper">
    <video id="video" autoplay data-a="cb00a3c3" class="video" controls="true" preload="yes" poster="http://cdn.foo.com/bar.png"height=340 width=640> 
        <source id="src" src="http://83.66.137.45/cagri.tacyildiz/PIVApi/Video/Get?refVideo=cb00a3c3&refPerso=1&ext=.mp4" type="video/mp4">
        <source src="http://83.66.137.45/cagri.tacyildiz/PIVApi/Video/Get?refVideo=cb00a3c3&refPerso=1&ext=.webm" type="video/webm">
        <source src="http://83.66.137.45/cagri.tacyildiz/PIVApi/Video/Get?refVideo=cb00a3c3&refPerso=1&ext=.ogg" type="video/ogg">
        Your browser does not support the video tag.
    </video>

        <div class="playpause"></div>
    </div>

    <script src="http://83.66.137.45/cagri.tacyildiz/PIV/scripts/jquery-2.1.1.min.js"></script> 


</body></html>

我从MVC API获取视频源,如下所示。

 public ActionResult Get(string refVideo,int refPerso,string type="video", string ext = ".mp4")
        {
            Tuple<byte[], string> data = VideoRepository.Get(refVideo, refPerso, type,ext);

            if (data == null)
                return null;

            return File(data.Item1, data.Item2);
        }

我找不到解决方案,为什么它不适用于移动游猎。我在哪里弄错了,我该如何解决这个问题?

0 个答案:

没有答案