如何将视频添加到移动网络浏览器的网页中

发布于 2024-09-02 11:47:20 字数 587 浏览 3 评论 0原文

我们公司正在制作我们网站的移动版本。我们有几个产品视频想在移动版本上展示。

当我尝试使用时,

<a href="video.wmv">video</a> 

我的 HTC 令人难以置信的 Android 操作系统手机上有声音播放,但黑屏。

我认为视频正在播放,但在不同的浏览器窗口中。我需要它在一个窗口中显示所有内容,而无需切换到另一窗口。

我尝试了 html 嵌入标签,但根本没有得到任何视频或声音,据我所知,这些标签在跨浏览器上不是很可靠。

我也刚刚尝试了下面的 html5 视频标签。我看到一个图标,表明它是视频文件,但无法播放。

<video src="video.wmv" controls="controls">
      your browser does not support the video tag
</video>

视频文件需要采用特殊格式吗?我应该使用 href 或嵌入标签,还有哪些其他选项?

如果有帮助的话,我正在我的网页上使用移动文档类型。

谢谢

Our company is making a mobile version of our website. We have several product videos we want to show on the mobile version.

When I try to use

<a href="video.wmv">video</a> 

I get sound playing but a black screen on my htc incredible android os phone.

I'm thinking that the video is playing but in a different browser window. I need it to display all in one window without having to switch to a different window.

I tried the html embed tags and get no video or sound at all, from what I've read these tags are not very realiable cross browser.

I also just tried the html5 video tags below. I get an icon identifying that it's a video file but it doesn't play.

<video src="video.wmv" controls="controls">
      your browser does not support the video tag
</video>

Is there a special format the video file needs to be in? Should I be using the href or embed tags, what other options do I have?

If it helps to know, I'm using the mobile doctype on my webpages.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

话少情深 2024-09-09 11:47:20

您需要发送到浏览器的视频格式因浏览器而异。 Firefox 支持 Ogg Theora,其他人似乎都支持 MPEG-4 容器(MP4 文件)中的 H.264。

请参阅此处的示例:http://html5demos.com/two-videos

无论如何,WMV 都无法工作。

The video format you need to send to the browser varies by browser. Firefox supports Ogg Theora, everybody else seems to support H.264 in an MPEG-4 container (MP4 file.)

See here for an example: http://html5demos.com/two-videos

In any case, WMV won't work.

非要怀念 2024-09-09 11:47:20

Android 通常不支持 WMV 格式。以下是支持的格式列表:

http://developer.android.com /guide/appendix/media-formats.html

如果 iPhone/blackberry/etc 没有共同的格式,您可能需要一些基于用户代理的 JavaScript 魔法来选择要嵌入的文件。

Android doesn't support the WMV format normally. Here is a list of the supported formats:

http://developer.android.com/guide/appendix/media-formats.html

If iPhone/blackberry/etc don't have a format in common, you may need some javascript magic based on the user-agent to choose which file to embed.

不必你懂 2024-09-09 11:47:20

我找到了解决我的问题的简单方法。 YouTube。在 YouTube 上上传需要在您的移动网站上播放的视频并且它们可以正常工作。时期。

不用大惊小怪!只需将嵌入的 URL 从 YouTube 视频页面复制到您的移动页面即可开始使用。

我不太确定 YouTube 如何使视频兼容。我猜测上传视频时它会自动转换为多种格式,以便根据访问页面的智能手机播放正确的编解码器/容器。

这个列表并不广泛,我稍后可能会想到更多,但如果您能想到使用 YouTube 播放移动视频的更多优点或缺点,请发表评论。

优点:

++ YouTube 被大多数主流智能手机普遍接受(因此您的视频应该可以播放!)。

+ 如果您的带宽有限,您无需担心浪费自己的带宽。

++ 易于设置,几乎不需要配置(设置视频分辨率)。它就是有效的! (封装...)

缺点:

- 视频播放期间的 YouTube 符号

- 它不托管在您的托管服务上。某些分析服务可能无法跟踪。 (需要自定义跟踪? onclick java 脚本事件?)

- YouTube 带宽可能无法流畅重播? (虽然从最初的视频观看带宽来看似乎可以接受(最小缓冲...),但尚未确认...)。可能主要取决于手机3g/4g连接质量。

- 视频文件大小/分辨率有限?应该不是问题,因为您需要为智能手机提供较低质量的视频。

我想确切地知道 YouTube 如何使其视频与智能手机兼容,以便如有必要我可以自己托管视频,但目前这似乎是最佳选择。

I've found a simple solution to my problem. YouTube. Upload videos on youtube that need to play on your mobile web site and they work. PERIOD.

No fuss! Just copy the embedded URL from the YouTube video page to your mobile page and your all set to go.

I'm not exactly sure how YouTube makes the videos compatible.I'm guessing when uploading the video it's automatically converted into several formats so that the right codec / container is played based on what smart phone is accessing the page.

This list is not extensive and I'll probably think of more later, but comment if you can think of any more advantages or disadvantages of using YouTube for mobile videos.

Advantages:

++ YouTube is universally accepted amongst most major smart phones (therefore your video should play!).

+ If you have limited bandwidth you don't need to worry about wasting any bandwidth of your own.

++ Easy to setup, little to no configuration (setting video resolution). It just works! (encapsulation...)

Disadvantages:

- YouTube symbol during video play back

- It's not hosted on your hosting service. May not be tracked by some analytic services. (requires custom tracking? onclick java-script event?)

- YouTube bandwidth may not be acceptable for smooth replay? (although from initial video viewing bandwidth seems acceptable (minimal buffering...), but not confirmed...). Probably mostly dependent on the cell phone 3g / 4g connection quality.

- limited video file size / resolutions? shouldn't be a problem because you'll want a lower quality video for smart phones.

I would like to know exactly how YouTube make it's videos compatible with smart phones so if necessary I could host the videos myself, but for now this seems to be the best choice.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文