日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > vue >内容正文

vue

【vue-video-player视频播放器】

發布時間:2024/1/1 vue 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【vue-video-player视频播放器】 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

【vue-video-player視頻播放器】

  • Vue-Video-Player
    • NPM
    • Mount
    • 下面附上常見的mimetype配置列表

Vue-Video-Player

video.js player component for Vue.
適用于 Vue 的 video.js 播放器組件。

https://github.com/surmon-china/vue-video-player

NPM

安裝

npm install vue-video-player --save

Mount

在main.js中添加(mount with global)

import Vue from 'vue' import VueVideoPlayer from 'vue-video-player'// require videojs style import 'video.js/dist/video-js.css' // import 'vue-video-player/src/custom-theme.css'Vue.use(VueVideoPlayer, /* {options: global default options,events: global videojs events } */)

新建一個vueVideoPlayer.vue組件供調用(mount with component)

<template><div id="vueVideoPlayer"><video-player class="video-player vjs-custom-skin" ref="videoPlayer" :playsinline="true" :options="playerOptions"></video-player></div> </template><script> export default {name: 'vueVideoPlayer',props: {src: {type: String},cover_url: {type: String}},data () {return {// 配置信息playerOptions: {playbackRates: [0.7, 1.0, 1.5, 2.0], // 播放速度autoplay: false, // 如果true,瀏覽器準備好時開始回放。muted: false, // 默認情況下將會消除任何音頻。loop: false, // 導致視頻一結束就重新開始。preload: 'auto', // 建議瀏覽器在<video>加載元素后是否應該開始下載視頻數據。auto瀏覽器選擇最佳行為,立即開始加載視頻(如果瀏覽器支持)language: 'zh-CN',aspectRatio: '16:10', // 將播放器置于流暢模式,并在計算播放器的動態大小時使用該值。值應該代表一個比例 - 用冒號分隔的兩個數字(例如"16:9"或"4:3")fluid: true, // 當true時,Video.js player將擁有流體大小。換句話說,它將按比例縮放以適應其容器。sources: [{src: this.src, // 路徑type: 'video/mp4' // 類型}],poster: this.cover_url, // 你的封面地址// width: document.documentElement.clientWidth,notSupportedMessage: '此視頻暫無法播放,請稍后再試', // 允許覆蓋Video.js無法播放媒體源時顯示的默認信息。controlBar: {timeDivider: true,durationDisplay: true,remainingTimeDisplay: false,fullscreenToggle: true // 全屏按鈕}}}} }

在其他組件調用

<vueVideoPlayer :src="data.url" :cover_url="data.cover_url" />import vueVideoPlayer from './module/vueVideoPlayer' // 不要忘記注冊 components: {vueVideoPlayer }

下面附上常見的mimetype配置列表

Video TypeExtensionMIME Type
Flash.flvvideo/x-flv
MPEG-4.mp4video/mp4
iPhone Index.m3u8application/x-mpegURL
iPhone Segment.tsvideo/MP2T
3GP Mobile.3gpvideo/3gpp
QuickTime.movvideo/quicktime
A/V Interleave.avivideo/x-msvideo
Windows Media.wmvvideo/x-ms-wmv

MIME類型,詳細查看MIME 類型 - HTTP | MDN

終是悟空成了佛
你一墮落便是魔

總結

以上是生活随笔為你收集整理的【vue-video-player视频播放器】的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。