Embed video and play on android

我怕爱的太早我们不能终老 提交于 2019-12-13 15:30:50

问题


I embed a mp4 video into a webpage, using the embed src script. I can view it when I browse from iphone, but not android.

I did some research and found out that I need to use html 5, which uses the tag.

However, how do I find out what version of the video I have? I tried

<video width="560" height="340" controls>
  <source src="<?php echo $video; ?>" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
</video>

But it's not working either. Any ideas? Thank you in advance


回答1:


<video id="video" autobuffer height="240" width="360" controls  onclick="this.play();">
<source src="<?php echo $video; ?>">
</video>

video must be encoded properly for the device




回答2:


Here's a slight variation on a theme: If you're only serving up an MP4 for mobile devices, you can roll the source tag right into the video tag, like so:

<video src="<?php echo $video; ?>" id="video" width="360" height="240" type="video/mp4" controls autobuffer onclick="this.play();"></video>

Support for the video tag also greatly depends on what version of Android you're running. You definitely need version 2.0 or higher and some older phones like the Nexus One stutter on playback of some higher bitrate videos.




回答3:


I know some devices choke when you specify codecs...some actually are really anal about following that rule. Something to consider is the JW Player. The latest release just dealt with android.




回答4:


I have been trying to get .mp4 to work on an android phone, kindle fire and iphone all day. after looking at many websites such as this I found the answer by pure luck and the relentless try try again.

upload your video files to you network first.

go back into the html editor and put the full web address as the source, not just the location from the html current position.

Example:

video controls="controls" autohide="autohide" autoplay="autoplay" loop="loop" poster="wait.jpg" width="900" height="400"

source src="http://www.website.com/cust/flash/bf1/sc2/sc2.mp4" type="video/mp4"

/video

in older device browsers some features like loop and auto play don't work but the video will appear and play. This worked for me.

hope this is helpfull



来源:https://stackoverflow.com/questions/4057057/embed-video-and-play-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!