::: danger You should consider <video>
as demo purpose, and re-implement it your favourite video library. :::
The video component can be used to embed video content in a Weex page.
A text
is the only valid type of child component.
pause
。nocontrols
, native video component will hide its play-back control panel.<template> <div> <video class="video" :src="src" autoplay controls @start="onstart" @pause="onpause" @finish="onfinish" @fail="onfail"></video> <text class="info">state: {{state}}</text> </div> </template> <style scoped> .video { width: 630px; height: 350px; margin-top: 60px; margin-left: 60px; } .info { margin-top: 40px; font-size: 40px; text-align: center; } </style> <script> export default { data () { return { state: '----', src:'http://flv2.bn.netease.com/videolib3/1611/01/XGqSL5981/SD/XGqSL5981-mobile.mp4' } }, methods:{ onstart (event) { this.state = 'onstart' }, onpause (event) { this.state = 'onpause' }, onfinish (event) { this.state = 'onfinish' }, onfail (event) { this.state = 'onfinish' } } } </script>
rax-video
is the component <video>
of rax, which can run in web and weex.
import { createElement, Component, render } from "rax"; import Video from "rax-video"; import Driver from "driver-universal"; render( <Video style={{ width: '750rpx', height: '400rpx' }} autoPlay src="https://cloud.video.taobao.com/play/u/2780279213/p/1/e/6/t/1/d/ld/36255062.mp4" />, document.body, { driver: Driver } );