@boldarialblack/multi-stream-player 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,21 +1,91 @@
1
1
  # 用法
2
2
  使用包管理器(如 NPM、Yarn 或 pnpm)安装
3
3
  ```
4
- npm install multi-stream-player --save
4
+ npm install @boldarialblack/multi-stream-player --save
5
5
  ```
6
- 安装后引入组件
7
- ```
8
- import StreamPlayer from 'multi-stream-player';
6
+ `@boldarialblack/multi-stream-player` 支持 Vue 2.7.0+ 和 Vue 3.0.0+
7
+
8
+ ## Vue 3 使用方式
9
+
10
+ ```javascript
11
+ import { createApp } from 'vue'
12
+ import App from './App.vue'
13
+ import StreamPlayer from '@boldarialblack/multi-stream-player'
14
+ import '@boldarialblack/multi-stream-player/style.css';
15
+
16
+ const app = createApp(App)
17
+ app.use(StreamPlayer)
18
+ app.mount('#app')
9
19
  ```
10
- 使用
20
+
21
+ 在组件中使用:
22
+
23
+ ```vue
24
+ <template>
25
+ <div>
26
+ <!-- 直接使用组件 -->
27
+ <StreamPlayer :src="url" />
28
+
29
+ <!-- 或使用对话框模式 -->
30
+ <button @click="openPlayer">打开播放器</button>
31
+ </div>
32
+ </template>
33
+
34
+ <script>
35
+ export default {
36
+ methods: {
37
+ openPlayer() {
38
+ this.$streamPlayer.open({
39
+ title: '播放器',
40
+ src: 'http://example.com/stream'
41
+ })
42
+ }
43
+ }
44
+ }
45
+ </script>
11
46
  ```
12
- <stream-player
13
- src="//sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/hls/xgplayer-demo.m3u8"
14
- protocol="hls"
15
- >
16
- </stream-player>
47
+
48
+ ## Vue 2 使用方式
49
+
50
+ ```javascript
51
+ import Vue from 'vue'
52
+ import App from './App.vue'
53
+ import StreamPlayer from '@boldarialblack/multi-stream-player'
54
+ import '@boldarialblack/multi-stream-player/style.css';
55
+
56
+ Vue.use(StreamPlayer)
57
+
58
+ new Vue({
59
+ render: h => h(App)
60
+ }).$mount('#app')
17
61
  ```
18
62
 
63
+ 在组件中使用:
64
+
65
+ ```vue
66
+ <template>
67
+ <div>
68
+ <!-- 直接使用组件 -->
69
+ <StreamPlayer :src="url" />
70
+
71
+ <!-- 或使用对话框模式 -->
72
+ <button @click="openPlayer">打开播放器</button>
73
+ </div>
74
+ </template>
75
+
76
+ <script>
77
+ export default {
78
+ methods: {
79
+ openPlayer() {
80
+ this.$streamPlayer.open({
81
+ title: '播放器',
82
+ src: 'http://example.com/stream'
83
+ })
84
+ }
85
+ }
86
+ }
87
+ </script>
88
+ ```
19
89
  # 详细文档
20
90
  指路 ➡️ /docs/components/index.md
21
91