Vue uses vue-h265-player to play h265 encoded format video stream

GitHub address

vue-h265-player

Support h265 encoding format video stream playback

vue use vue-h265-player

1. Install vue-h265-player

npm install vue-h265-player

2. Copy the libDecoder.wasm file to the public directory

Copy the node_modules/h265-player/lib/libDecoder.wasm file to the public directory

insert image description here

3. Sample code

url: The link that needs to be played, the player will automatically restart according to the change of this value.
maxRetryCount: The maximum number of reconnection attempts, which will be triggered after the upper limit is reached. on-errorevents:
on-error: This method will be triggered when the link is unavailable

<template>
  <div id="app">
    <H265Player
      @on-error="handleOnError"
      :url="url"
      style="width: 80vw;height:45vw"
    />
  </div>
</template>

<script>
  import H265Player from 'vue-h265-player';

  export default {
      
      
    name: 'App',
    components: {
      
      
      H265Player,
    },
    data: () => ({
      
      
      url: 'a h265 hls url',
    }),
    methods: {
      
      
      handleOnError(error) {
      
      
        console.log('error: ', error);
      },
    },
  };
</script>

Guess you like

Origin blog.csdn.net/qq_40042416/article/details/129612600