国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

video.js 視頻截圖、錄制、自定義全屏,hls、flv、mp4視頻播放

這篇具有很好參考價(jià)值的文章主要介紹了video.js 視頻截圖、錄制、自定義全屏,hls、flv、mp4視頻播放。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

功能

  • video.js內(nèi)嵌 截圖、錄制功能 (圖片、視頻會(huì)下載到本地)
  • 自定義全屏
  • 播放hls、flv、mp4
  • 功能集合成Vue組件

參考

  • video.js components
  • RecordRTC demo
  • video 截圖并下載
  • video.js添加自定義組件的方法
  • 使用RecordRTC對(duì)video視頻進(jìn)行錄制

播放hls、flv、mp4

安裝

// video.js
npm install video.js
// 播放hls
npm install  videojs-contrib-hls
// 播放flv
npm install videojs-flvjs-es6
npm install flv.js

引入

import "videojs-contrib-hls";
import "videojs-flvjs-es6";
import videojs from "video.js";
import video_zhCN from "video.js/dist/lang/zh-CN.json";
videojs.addLanguage("zh-CN", video_zhCN);

export default {
  props: {
    name: {
      type: String,
      default: "my-video",
    },
    // 視頻地址
    videoUrl: {
      type: String,
      default: "",
    },
    //視頻寬度
    videoWidth: {
      type: String,
      default: "100%",
    },
    //視頻高度
    videoHeight: {
      type: String,
      default: "100%",
    },
  },
  data() {
    const options = 
      {
        // 封面圖
        poster: '',
        language: "zh-CN",
        // 設(shè)置自動(dòng)播放
        autoplay: true,
        // 設(shè)置了它為true,才可實(shí)現(xiàn)自動(dòng)播放,同時(shí)視頻也被靜音 (Chrome66及以上版本,禁止音視頻的自動(dòng)播放)
        muted: true,
        // 預(yù)加載
        preload: "none",
        // 顯示播放的控件
        controls: true,
        // 進(jìn)度條
        liveui: true,
        notSupportedMessage: "此視頻暫無(wú)法播放,請(qǐng)稍后再試", // 允許覆蓋Video.js無(wú)法播放媒體源時(shí)顯示的默認(rèn)信息。
        // 播放速率
        playbackRates: [0.5, 1, 2, 4, 8, 16],
        controlBar: {
          // 畫中畫
          pictureInPictureToggle: false,
          // 當(dāng)前時(shí)間和持續(xù)時(shí)間的分隔符
          timeDivider: true,
          // 顯示持續(xù)時(shí)間
          durationDisplay: true,
          // 是否顯示剩余時(shí)間功能
          remainingTimeDisplay: true,
          // 是否顯示全屏按鈕
          fullscreenToggle: true,
        },
    }
    return {
      options,
      // videoUrl 從無(wú)到有時(shí)會(huì)顯示一會(huì)視頻錯(cuò)誤信息
      // 使用該字段判斷 no-video 來(lái)避免顯示錯(cuò)誤信息
      hasVideoUrl: false,
      // 視頻流類型
      videoTypeObj: {
        mp4: 'video/mp4',
        flv: 'video/x-flv',
        m3u8: 'application/x-mpegURL'
      }
    };
  },
  methods: {
    getVideo(nowPlayVideoUrl) {
      if (!nowPlayVideoUrl) this.hasVideoUrl = false;
      if (!this.player) {
        this.player = videojs(this.$refs.player, this.options);
      }
      this.player.src([
        {
          src: nowPlayVideoUrl,
          type: this.videoUrl
          ?
          this.videoTypeObj[this.videoUrl.split('.').slice(-1)]
          :
          ''
        },
      ]);
      setTimeout(() => {
        this.hasVideoUrl = !!nowPlayVideoUrl;
      }, 100);
    }
  },
  watch: {
    //監(jiān)聽(tīng)視頻地址、video的id值
    videoUrl: {
      deep: true,
      immediate: true,
      handler(val) {
        this.$nextTick(() => {
          this.getVideo(val);
        });
      },
    },
  },
  beforeDestroy() {
    // 組件銷毀時(shí),清除播放器
    if (this.player) this.player.dispose();
  },
};

html

  <div
    :style="{ width: videoWidth, height: videoHeight, position: 'relative' }"
    class="display"
  >
    <video
      style="width: 100%; height: 100%"
      class="video-js"
      ref="player"
      v-show="videoUrl"
    >
    </video>
    <!-- 視頻路徑為空時(shí) -->
    <div
      v-show="!hasVideoUrl"
      :style="{
        height: videoWidth,
        width: videoHeight,
        position: 'absolute',
        left: 0,
        top: 0,
        zIndex: 2,
        background: '#000',
      }"
    >
      no video
    </div>
  </div>

引入組件(視頻地址使用的時(shí)西瓜的測(cè)試視頻)


import Player from './components/Player.vue'

export default {
  name: 'App',
  components: {
    Player
  },
  data: {
      // flv
      nowPlayVideoUrl: "http://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv",
      // mp4
      // nowPlayVideoUrl: "http://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/mp4/xgplayer-demo-360p.mp4",
      // hls
      // nowPlayVideoUrl: "http://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/hls/xgplayer-demo.m3u8",

  }
...
}
<template>
    <div style="height:400px;width:600px">
      <Player :videoUrl="nowPlayVideoUrl"/>
    </div>
</template>

加入自定義全屏

在props中加入 name 、fullscreenType、fullscreenChange屬性

  props:{
    ...
  // 當(dāng)存在多個(gè)直播時(shí),用于判斷是哪個(gè)直播需要全屏
   name: {
      type: String,
      default: "my-video",
    },
    // 全屏類型
    fullscreenType: {
      type: String,
      default: "initial",
      validator: function (value) {
        // 這個(gè)值必須匹配下列字符串中的一個(gè)
        return ["none", "DIY", "initial"].indexOf(value) !== -1;
     },
    // 全屏狀態(tài)改變 當(dāng)fullscreenType為DIY時(shí)有效
    fullscreenChange: {
      type: Function,
      default: () => {},
    },
}

修改options

   const options= {
    ...
    controlBar: {
          // 畫中畫
          pictureInPictureToggle: false,
          // 當(dāng)前時(shí)間和持續(xù)時(shí)間的分隔符
          timeDivider: true,
          // 顯示持續(xù)時(shí)間
          durationDisplay: true,
          // 是否顯示剩余時(shí)間功能
          remainingTimeDisplay: true,
          // 是否顯示全屏按鈕
          fullscreenToggle: this.fullscreenType === "initial" ? true : false,
        },
}     

修改getVideo方法

if (!nowPlayVideoUrl) this.hasVideoUrl = false;
      if (!this.player) {
        this.player = videojs(this.$refs.player, this.options);
        // 自定義全屏功能
        if (this.fullscreenType === "DIY") this.setDIYFullscreen();
      }
    ...
}

編寫setDIYFullscreen方法

setDIYFullscreen() {
      const fullscreenButton = this.player.controlBar.addChild("button");
      fullscreenButton.controlText("全屏");
      fullscreenButton.addClass("vjs-fullscreen-control");
      const fullscreenButtonDom = fullscreenButton.el();
      fullscreenButtonDom.onclick = () => {
        this.isDIYFullscreen = !this.isDIYFullscreen;
        if (this.isDIYFullscreen) {
          this.player.addClass("vjs-fullscreen");
          fullscreenButton.controlText("退出全屏");
          console.log('全屏');
        } else {
          this.player.removeClass("vjs-fullscreen");
          fullscreenButton.controlText("全屏");
          console.log('退出全屏');
        }
        // 父組件回調(diào)
        this.fullscreenChange(this.isDIYFullscreen, this.name);
      };
    }

修改父組件引入

<template>
    <div style="height:400px;width:600px">
      <Player fullscreenType="DIY" :videoUrl="nowPlayVideoUrl"/>
    </div>
</template>

效果

自定義全屏

加入截圖、錄制功能

安裝

// 錄制所需插件
npm i recordrtc

創(chuàng)建video.js文件,將video.js相關(guān)引入、邏輯都放整合放在這里(自定義全屏除外)

import videojs from "video.js";
import video_zhCN from "video.js/dist/lang/zh-CN.json";
import RecordRTC from "recordrtc";
import "videojs-contrib-hls";
import "videojs-flvjs-es6";
// 截圖圖片
import cameraImg from '../assets/images/camera.png'
// 錄像圖片
import monitorImg from '../assets/images/monitor.png'
videojs.addLanguage("zh-CN", video_zhCN);

// 創(chuàng)建 截圖、錄像
var Component = videojs.getComponent("Component");
var CustomBar = videojs.extend(Component, {
    constructor: function (player, options) {},
    createEl: function () {
        return videojs.dom.createEl('div', {
            innerHTML: `這是一個(gè)自定義組件`
        })
    }
})

// 注冊(cè) 截圖、錄像組件
videojs.registerComponent('CustomBar', CustomBar);

export default videojs

創(chuàng)建custom-video.css文件,video相關(guān)css放在這里

@import "video.js/dist/video-js.css";

更改組件引入,以及在options中加入customBar?

import videojs from '../utils/video'
import '../assets/css/custom-video.css'
....
options = {
    customBar: {}
    ...
}

效果video.js 視頻截圖、錄制、自定義全屏,hls、flv、mp4視頻播放

?修改CustomBar,界面顯示

...
// 截圖圖片
import cameraImg from '../assets/images/camera.png'
// 錄制圖片
import monitorImg from '../assets/images/monitor.png'

var CustomBar = videojs.extend(Component, {
    ...
  createEl: function () {
    const divDom = videojs.dom.createEl('div', {
      className: 'vjs-custom-bar',
      innerHTML: `
        <div  class="vjs-custom-control-bar vjs-button ac">
          <img src="${cameraImg}" style="width:13px" />
          <span class="ml10">截圖</span>
        </div>
        <div class="mt10 vjs-custom-control-bar ac" >
          <img src="${monitorImg}" style="width:13px" />
          <span class="ml10">錄像</span>
        </div>
      `
    })
    return divDom
  }
}

修改custom-video.css

customBar位于右側(cè)中間顯示,鼠標(biāo)活動(dòng)以及懸浮在customBar顯示customBar,不活動(dòng)時(shí)隱藏

錄制中時(shí)紅點(diǎn)閃爍

@import "video.js/dist/video-js.css";
.vjs-custom-bar {
  position: absolute;
  color: #fff;
  right: 10px;
  transform: translateY(-50%);
  top: 50%;
}
.vjs-custom-bar:hover {
  opacity: 1 !important;
}
.vjs-custom-control-bar {
  padding: 10px;
  background: rgba(43, 51, 63, 0.7);
  border-radius: 5px;
  cursor: pointer;
}
/* 開(kāi)始錄制 閃爍 */
.record-procees {
  display: inline-block;
  height: 10px;
  width: 10px;
  background: red;
  border-radius: 8px;
  animation: blings 1s linear infinite;
}
.mt10 {
  margin-top: 10px;
}
.ml10 {
  margin-left: 10px;
}
.ac {
  display: flex;
  align-items: center;
}
@keyframes blings {
  0% {
    opacity: 0.1;
  }
  100% {
    opacity: 1;
  }
}
.video-js .vjs-custom-bar {
  color: white;
  /* font-size: 2em; */
  padding: .5em;
 
 }
 
 .vjs-has-started .vjs-custom-bar {
  /* display: flex; */
  visibility: visible;
  opacity: 1;
  transition: visibility 0.1s, opacity 0.1s;
 }
 /* 用戶不活動(dòng)時(shí)設(shè)計(jì)title bar自動(dòng)隱藏 */
 .vjs-has-started.vjs-user-inactive.vjs-playing .vjs-custom-bar {
 
  visibility: visible;
 
  /*visibility: hidden;*/
 
  opacity: 0;
 
  transition: visibility 1s, opacity 1s;
 
 }
 .vjs-controls-disabled .vjs-custom-bar,
 .vjs-using-native-controls .vjs-custom-bar,
 .vjs-error .vjs-custom-bar {
  display: none !important;
 }
 .vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-custom-bar {
  opacity: 0;
  visibility: visible;
  /*visibility: hidden;*/
 }
 .vjs-has-started.vjs-no-flex .vjs-custom-bar {
  display: table;
 }

CustomBar加入隱藏邏輯

...
constructor: function (player, options) {
    // Equivalent of `super(this, arguments)`
    Component.apply(this, arguments);
    // 隱藏截圖
    if (options.screenshot === false) this.hiddenEl(0)
    // 隱藏錄像
    if (options.recorder === false) this.hiddenEl(1)
},
createEl: function () {
...
}
  hiddenEl (index) {
    const myDom = this.el().querySelectorAll('div')[index]
    myDom.setAttribute('style', 'display:none')
  }

當(dāng)需要隱藏錄像時(shí),修改options中customBar屬性

options = {
        // 截圖、錄制Bar
        customBar: {
          screenshot: true,
          recorder: false
        }
    ....
}

customBar加入截圖、錄制邏輯

...  
constructor: function (player, options) {
    // Equivalent of `super(this, arguments)`
    Component.apply(this, arguments);
    // player 實(shí)列
    this.player = player
    // 錄像所需要的 canvas
    this.canvas = null
    // 錄像實(shí)列
    this.recorder = null
    // 停止循環(huán)幀 需要用到的參數(shù)
    this.animationFrame = null
    // 錄像狀態(tài) false 未錄像 true 錄像中
    this.isRecorder = false
    // 隱藏截圖
    if (options.screenshot === false) this.hiddenEl(0)
    // 隱藏錄像
    if (options.recorder === false) this.hiddenEl(1)
},
createEl: function () {
    const divDom = videojs.dom.createEl('div', {
      className: 'vjs-custom-bar',
      innerHTML: `
        <div  class="vjs-custom-control-bar vjs-button ac">
          <img src="${cameraImg}" style="width:13px" />
          <span class="ml10">截圖</span>
        </div>
        <div class="mt10 vjs-custom-control-bar ac" >
          <img src="${monitorImg}" style="width:13px" />
          <span class="ml10">錄像</span>
        </div>
      `
    })
    const [screenshotDom, recordDom] = divDom.querySelectorAll('div')
    screenshotDom.onclick = () => this.screenshotHandle()
    recordDom.onclick = () => this.recordHandle(recordDom)
    return divDom
  },
...

截圖?screenshotHandle方法

  // 截圖
  screenshotHandle() {
    const fileType = "png";
    // 找到需要截圖的video標(biāo)簽
    // video 實(shí)列
    const video = this.player.el().querySelector('video')
    // const video = this.video;
    console.log(video, 'video');
    const canvas = document.createElement("canvas");
    canvas.width = video.videoWidth;
    canvas.height = video.videoHeight;
    console.log(canvas, 'canvas')
    canvas
      .getContext("2d")
      .drawImage(video, 0, 0, canvas.width, canvas.height); // 圖片大小和視頻分辨率一致
    const strDataURL = canvas.toDataURL("image/" + fileType); // canvas中video中取一幀圖片并轉(zhuǎn)成dataURL
    let arr = strDataURL.split(","),
      mime = arr[0].match(/:(.*?);/)[1],
      bstr = atob(arr[1]),
      n = bstr.length,
      u8arr = new Uint8Array(n);
    while (n--) {
      u8arr[n] = bstr.charCodeAt(n);
    }
    const blob = new Blob([u8arr], {
      type: mime,
    });
    const url = window.URL.createObjectURL(blob);
    this.downloadFile(url, "png");
  },

錄制?recordHandle方法,

  // 錄像
  recordHandle (recordDom) {
    this.isRecorder = !this.isRecorder
    if (this.isRecorder) {
      recordDom.innerHTML = `<i class="record-procees"></i><span class="ml10">結(jié)束</span>`
      if (!this.canvas) this.canvas = document.createElement("canvas");
      this.recorder = RecordRTC(this.canvas, {
        type: "canvas",
      });
      this.recorder.startRecording();
      this.drawMedia();
    } else {
      // recordDom.innerHTML = `<i class="el-icon-video-camera-solid"></i><span class="ml10">錄像</span>`
      recordDom.innerHTML = `<img src="${monitorImg}" style="width:13px" /><span class="ml10">錄像</span>`
      this.recorder.stopRecording(() => {
        const url = window.URL.createObjectURL(this.recorder.getBlob());
        this.downloadFile(url, "mp4");
        cancelAnimationFrame(this.animationFrame);
        this.canvas = null;
        this.animationFrame = null;
      });
    }
  },
  // 刷新canvas
  drawMedia() {
    const ctx = this.canvas.getContext("2d");
    // 找到需要截圖的video標(biāo)簽
    const video = this.player.el().querySelector('video')
    this.canvas.setAttribute("width", video.videoWidth);
    this.canvas.setAttribute("height", video.videoHeight);
    ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
    // requestAnimationFrame 根據(jù)電腦顯示幀數(shù)進(jìn)行循環(huán)
    this.animationFrame = requestAnimationFrame(() => this.drawMedia());
  },

文件下載downloadFile

  // 下載
  downloadFile: function (blob, fileType) {
    const a = document.createElement("a");
    a.style.display = "none";
    a.href = blob;
    // const time = this.parseTime(new Date())
    const time = new Date().getTime();
    a.download = `${time}.${fileType}`;
    document.body.appendChild(a);
    a.click();
    setTimeout(function () {
      document.body.removeChild(a);
      window.URL.revokeObjectURL(blob);
    }, 1000);
  },

解決RecordRTC錄制報(bào)錯(cuò)

video.js 視頻截圖、錄制、自定義全屏,hls、flv、mp4視頻播放

?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-403713.html

?在public下index.html引入該文件

    <!-- 下載到本地引入 -->
    <script src="screenshot.js"></script>
    <!-- 官方路徑引入 -->
    <!-- <script src="https://www.webrtc-experiment.com/screenshot.js"></script> -->

效果

截圖和視頻錄制

其中使用到的圖片

video.js 視頻截圖、錄制、自定義全屏,hls、flv、mp4視頻播放
圖片1
video.js 視頻截圖、錄制、自定義全屏,hls、flv、mp4視頻播放
圖片2

?

?

到了這里,關(guān)于video.js 視頻截圖、錄制、自定義全屏,hls、flv、mp4視頻播放的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 使用video.js完成hls/m3u8格式的視頻播放

    近期項(xiàng)目中,需要播放視頻,最開(kāi)始給了個(gè)測(cè)試接口是hls格式的,查了一下,使用了video.js插件來(lái)進(jìn)行播放。后期又改成了flv視頻,這里簡(jiǎn)單記錄一下。 1. 下載video.js插件,以及contrib-hls播放插件,頁(yè)面引入,這兩個(gè)插件,以及樣式 ? ? 這里好像涉及到版本問(wèn)題,高版本的v

    2024年02月14日
    瀏覽(27)
  • video.js的坑點(diǎn)和自定義video的播放、全屏、快進(jìn)操作

    一、使用插件video.js 遇到問(wèn)題:點(diǎn)擊背景視頻無(wú)法觸發(fā)播放和暫停的操作 問(wèn)題原因:在移動(dòng)端使用video.js與fastclick 沖突 解決方式:修改fastclick的源碼 二、 使用自定義video滿足ui設(shè)計(jì)的需求 解決方案:自定義進(jìn)度條、全屏操作 實(shí)際代碼:

    2024年02月15日
    瀏覽(17)
  • video.js 播放m3u8、flv、rtmp、RTS格式視頻

    ?第一種方案(只適用m3u8格式): 屬性 說(shuō)明 ? ?options: { ? ? ? ? ? ? ? ? ? ? autoplay: true, // 設(shè)置自動(dòng)播放 ? ? ? ? ? ? ? ? ? ? muted: true, // 設(shè)置了它為true,才可實(shí)現(xiàn)自動(dòng)播放,同時(shí)視頻也被靜音 (Chrome66及以上版本,禁止音視頻的自動(dòng)播放) ? ? ? ? ? ? ? ? ? ? prelo

    2024年02月12日
    瀏覽(36)
  • 【記錄處理Vue項(xiàng)目中Video.js播放不了MP4視頻Bug】

    【記錄處理Vue項(xiàng)目中Video.js播放不了MP4視頻Bug】

    在Vue項(xiàng)目中使用Video.js播放MP4視頻。 在項(xiàng)目中使用Video.js播放MP4視頻。視頻采集上來(lái)存在數(shù)據(jù)庫(kù),前端使用Video.js對(duì)視頻進(jìn)行播放。突然有一天,MP4視頻播放不了,并且報(bào)錯(cuò): VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) No compatible source was found for this media. 并發(fā)現(xiàn)前一時(shí)間段采集到

    2024年04月14日
    瀏覽(27)
  • vue video(視頻)禁止用戶拖動(dòng)進(jìn)度條,自定義組件實(shí)現(xiàn),包含視頻音量、暫停、播放、全屏、退出全屏 、播放進(jìn)度,話不多說(shuō)直接上代碼。

    ?注意項(xiàng)目中本組件使用到了elementUI所以要確保項(xiàng)目中安裝了 videoFree.vue js部分:因此為nuxtjs開(kāi)發(fā)的項(xiàng)目,代碼中this.$fmtS是一個(gè)格式化時(shí)間的工具類代碼后面有 css部分:

    2024年02月09日
    瀏覽(20)
  • vue 視頻播放插件vue-video-player自定義樣式、自動(dòng)播放設(shè)置、設(shè)置一開(kāi)始全屏播放視頻、監(jiān)聽(tīng)全屏事件

    vue 視頻播放插件vue-video-player自定義樣式、自動(dòng)播放設(shè)置、設(shè)置一開(kāi)始全屏播放視頻、監(jiān)聽(tīng)全屏事件

    1、背景 項(xiàng)目中有涉及視頻播放的需求,并且UI設(shè)計(jì)了樣式,與原生的視頻video組件有差異,所以使用了vue-video-player插件,并對(duì)vue-video-player進(jìn)行樣式改造,自定義播放暫停按鈕、全屏按鈕、時(shí)間進(jìn)度條樣式等,自動(dòng)播放設(shè)置、設(shè)置一開(kāi)始全屏播放視頻、監(jiān)聽(tīng)全屏事件等。 2、效

    2024年02月08日
    瀏覽(28)
  • vue 視頻播放插件vue-video-player自定義樣式、自動(dòng)播放設(shè)置、設(shè)置一開(kāi)始全屏播放視頻

    vue 視頻播放插件vue-video-player自定義樣式、自動(dòng)播放設(shè)置、設(shè)置一開(kāi)始全屏播放視頻

    1、背景 項(xiàng)目中有涉及視頻播放的需求,并且UI設(shè)計(jì)了樣式,與原生的視頻video組件有差異,所以使用了vue-video-player插件,并對(duì)vue-video-player進(jìn)行樣式改造,自定義播放暫停按鈕、全屏按鈕、時(shí)間進(jìn)度條樣式等,自動(dòng)播放設(shè)置、設(shè)置一開(kāi)始全屏播放視頻、監(jiān)聽(tīng)全屏事件等。 2、效

    2024年02月05日
    瀏覽(25)
  • vue自定義h5video視頻播放器進(jìn)度條組件,可拖拽、跳轉(zhuǎn)、倍速、全屏

    vue自定義h5video視頻播放器進(jìn)度條組件,可拖拽、跳轉(zhuǎn)、倍速、全屏

    一個(gè)進(jìn)度條組件控制多個(gè)視頻的播放、進(jìn)度調(diào)整。視頻可點(diǎn)擊全屏觀看,唯一的進(jìn)度條是某個(gè)指定視頻的視頻信息。 全屏 點(diǎn)擊進(jìn)度條跳轉(zhuǎn) 拖動(dòng)滑塊 在菜鳥教程上有以下幾個(gè)參數(shù)的詳細(xì)解說(shuō),這張圖忘記哪里看的了,如有認(rèn)領(lǐng)可評(píng)論我貼鏈接 倍速 // 倍速 handleChangeSpeed(item)

    2024年02月12日
    瀏覽(90)
  • 前端VUE播放RTSP、RTMP、HLS、FLV視頻流的解決方案

    前端VUE播放RTSP、RTMP、HLS、FLV視頻流的解決方案

    最近有個(gè)需求是前端在瀏覽器顯示攝像頭傳回的RTSP視頻流,我和后端都沒(méi)做過(guò)視頻流的項(xiàng)目,所以一步步摸索過(guò)來(lái),方法和經(jīng)驗(yàn)供大家參考。前端采用的技術(shù)有VUE+video.js+flv.js 從上圖可以看出,RTSP流不能直接在瀏覽器播放,所以需要轉(zhuǎn)碼: RTMP的流需要在瀏覽器中用flash播放

    2024年02月06日
    瀏覽(25)
  • react+video.js h5自定義視頻暫停圖標(biāo)

    react+video.js h5自定義視頻暫停圖標(biāo)

    目錄 參考網(wǎng)址 效果圖,暫停時(shí)顯示暫停圖標(biāo),播放時(shí)隱藏暫停圖標(biāo) 代碼說(shuō)明,代碼傳入url后,可直接復(fù)制使用 VideoPausedIcon.ts 組件 VideoCom.tsx Video.module.less 參考網(wǎng)址 ?在Video.js播放器中定制自己的組件 - acgtofe 效果圖,暫停時(shí)顯示暫停圖標(biāo),播放時(shí)隱藏暫停圖標(biāo) 代碼說(shuō)明,代

    2024年02月02日
    瀏覽(57)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包