html5 video error on Windows phone

2019-09-07 12:15发布

I'm trying to integrate video for mobile phones with HTML5. On iphone, OK, on Android it's slow but OK, and for windows phone, I have a bad error: invalid source . This is the code that don't work for Windows Phone:

<div align="center">
         <video autobuffer height="170" width="300" controls>
            <source src="http://dev.com/cloud.mp4" type="video/mp4">
            <source src="http://dev.com/cloud.webm" type="video/webm">
            <source src="http://dev.com/cloud.ogv" type="video/ogg">
         </video>
    </div>

I tried the code of W3Schools on the mobiles and it work on Windows Phone (This is the .mp4 that runs on WP) :

<div align="center">
         <video width="320" height="240" controls="">
            <source src="http://www.w3schools.com/html/movie.mp4" type="video/mp4">
            <source src="http://www.w3schools.com/html/movie.ogg" type="video/ogg">
        </video>
    </div> 

What is my mistake? If it is encodage, how Can I transform it and wich codec, ... HOW :-)

Thank you!

1条回答
叼着烟拽天下
2楼-- · 2019-09-07 13:00

The video was well encoded. the problem was there was a wrong MIME typeon the server configuration. The MIME was .mp4 => "application/octet-stream", but here the WP doesn't understand this MIME, so I edit it to "video/mp4", and it works.

查看更多
登录 后发表回答