如何在Angular2中嵌入视频? [英] How to embed videos in Angular2?
问题描述
我想开发单页应用程序.这是一个视频门户,用户可以在其中登录,查看视频列表,导航到单个视频,对视频进行评分,并可以执行所有与媒体相关的任务,例如:播放,暂停,调整音量和查找视频位置.
I want to develop single page application. It is a video portal, where users can login, see video listings, navigate to a single video, rate videos and can perform all media related tasks for example: Play, Pause, Adjust volume and seek video position.
由于HTML5
中有<video>
标签,是否可以在app.component.html
中使用HTML5
标签嵌入视频?
还是我必须从angular2
安装它然后在app.component.ts
文件中调用它的库?
也许还有另一种方法!
Since there is <video>
tag in HTML5
, Is it possible to use HTML5
tags inside app.component.html
to embed videos?
Or could it be a library that I have to install it from angular2
and then call it inside app.component.ts
file?
Or maybe there is another way!
推荐答案
除非您有需要,否则无需涉及Angular.在Angular模板中,您可以使用任何 HTML标记,只要您希望支持的浏览器支持它们即可.
No need to involve Angular, unless you find a need. Inside of your Angular template you can use any HTML tags, as long as they are supported by the browsers you wish to support.
只需在app.component.html
模板中包含HTML5 <video>
标记,然后将src属性指向视频的文件位置-
Simply include the HTML5 <video>
tag in your app.component.html
template and point the src attribute to the file location of your video -
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
示例是从 W3Schools HTML视频标记页
Example was copied from the W3Schools HTML Video tag page
这篇关于如何在Angular2中嵌入视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!