Skip to content

Commit

Permalink
feat: add VVideo component
Browse files Browse the repository at this point in the history
add new VVideo component for playing videos

Resolves vuetifyjs#5592
  • Loading branch information
dsseng committed Dec 2, 2018
1 parent f5bfaf8 commit fff1974
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
37 changes: 37 additions & 0 deletions packages/vuetify/src/components/VVideo/VVideo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Vue from 'vue'

// Types
import { VNode } from 'vue/types/vnode'

/* @vue/component */
export default Vue.extend({
name: 'VVideo',
props: {
src: String,
autoplay: Boolean,
loop: Boolean,
muted: Boolean
},
methods: {
play () {
(this.$refs.video as HTMLVideoElement).play()
},
pause () {
(this.$refs.video as HTMLVideoElement).pause()
}
},
render (h): VNode {
return h('div', { staticClass: 'v-video' }, [
h('video', {
ref: 'video',
staticClass: 'v-video-content',
attrs: {
autoplay: this.autoplay,
loop: this.loop,
muted: this.muted,
src: this.src
}
})
])
}
})
5 changes: 5 additions & 0 deletions packages/vuetify/src/components/VVideo/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import VVideo from './VVideo'

export { VVideo }

export default VVideo
1 change: 1 addition & 0 deletions packages/vuetify/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@ export * from './VTimePicker'
export * from './VToolbar'
export * from './VTooltip'
export * from './VTreeview'
export * from './VVideo'
export * from './VWindow'
export * from './transitions'
9 changes: 9 additions & 0 deletions packages/vuetify/src/stylus/components/_videos.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.v-video
position: relative

.v-video-content
position: fixed;
right: 0;
bottom: 0;
min-width: 100%;
min-height: 100%;

0 comments on commit fff1974

Please sign in to comment.