mpegts-vue3 0.3.0 → 0.3.2

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/dist/index.cjs CHANGED
@@ -58,7 +58,10 @@ const _sfc_main = /* @__PURE__ */ (0, vue.defineComponent)({
58
58
  type: { default: "mse" },
59
59
  cors: { type: Boolean },
60
60
  withCredentials: { type: Boolean },
61
- hasAudio: { type: Boolean },
61
+ hasAudio: {
62
+ type: Boolean,
63
+ default: true
64
+ },
62
65
  hasVideo: {
63
66
  type: Boolean,
64
67
  default: true
@@ -135,7 +138,7 @@ const _sfc_main = /* @__PURE__ */ (0, vue.defineComponent)({
135
138
  };
136
139
  if (props.cors !== void 0) source.cors = props.cors;
137
140
  if (props.withCredentials !== void 0) source.withCredentials = props.withCredentials;
138
- if (props.hasAudio !== void 0) source.hasAudio = props.hasAudio;
141
+ source.hasAudio = props.hasAudio;
139
142
  if (props.hasVideo !== void 0) source.hasVideo = props.hasVideo;
140
143
  if (props.duration !== void 0) source.duration = props.duration;
141
144
  if (props.filesize !== void 0) source.filesize = props.filesize;
@@ -171,8 +174,24 @@ const _sfc_main = /* @__PURE__ */ (0, vue.defineComponent)({
171
174
  status.value = "playing";
172
175
  emit("status", "playing");
173
176
  }).catch(() => {
174
- status.value = "stopped";
175
- emit("status", "stopped");
177
+ if (!props.muted && videoRef.value && player) {
178
+ videoRef.value.muted = true;
179
+ const fallbackResult = player.play();
180
+ if (fallbackResult instanceof Promise) fallbackResult.then(() => {
181
+ status.value = "playing";
182
+ emit("status", "playing");
183
+ }).catch(() => {
184
+ status.value = "stopped";
185
+ emit("status", "stopped");
186
+ });
187
+ else {
188
+ status.value = "playing";
189
+ emit("status", "playing");
190
+ }
191
+ } else {
192
+ status.value = "stopped";
193
+ emit("status", "stopped");
194
+ }
176
195
  });
177
196
  else {
178
197
  status.value = "playing";
package/dist/index.d.cts CHANGED
@@ -39,6 +39,7 @@ declare const _default: vue0.DefineComponent<Props, {
39
39
  isLive: boolean;
40
40
  muted: boolean;
41
41
  type: string;
42
+ hasAudio: boolean;
42
43
  hasVideo: boolean;
43
44
  config: Partial<MpegtsConfig>;
44
45
  }, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
package/dist/index.d.ts CHANGED
@@ -39,6 +39,7 @@ declare const _default: vue0.DefineComponent<Props, {
39
39
  isLive: boolean;
40
40
  muted: boolean;
41
41
  type: string;
42
+ hasAudio: boolean;
42
43
  hasVideo: boolean;
43
44
  config: Partial<MpegtsConfig>;
44
45
  }, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>;
package/dist/index.js CHANGED
@@ -34,7 +34,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
34
34
  type: { default: "mse" },
35
35
  cors: { type: Boolean },
36
36
  withCredentials: { type: Boolean },
37
- hasAudio: { type: Boolean },
37
+ hasAudio: {
38
+ type: Boolean,
39
+ default: true
40
+ },
38
41
  hasVideo: {
39
42
  type: Boolean,
40
43
  default: true
@@ -111,7 +114,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
111
114
  };
112
115
  if (props.cors !== void 0) source.cors = props.cors;
113
116
  if (props.withCredentials !== void 0) source.withCredentials = props.withCredentials;
114
- if (props.hasAudio !== void 0) source.hasAudio = props.hasAudio;
117
+ source.hasAudio = props.hasAudio;
115
118
  if (props.hasVideo !== void 0) source.hasVideo = props.hasVideo;
116
119
  if (props.duration !== void 0) source.duration = props.duration;
117
120
  if (props.filesize !== void 0) source.filesize = props.filesize;
@@ -147,8 +150,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
147
150
  status.value = "playing";
148
151
  emit("status", "playing");
149
152
  }).catch(() => {
150
- status.value = "stopped";
151
- emit("status", "stopped");
153
+ if (!props.muted && videoRef.value && player) {
154
+ videoRef.value.muted = true;
155
+ const fallbackResult = player.play();
156
+ if (fallbackResult instanceof Promise) fallbackResult.then(() => {
157
+ status.value = "playing";
158
+ emit("status", "playing");
159
+ }).catch(() => {
160
+ status.value = "stopped";
161
+ emit("status", "stopped");
162
+ });
163
+ else {
164
+ status.value = "playing";
165
+ emit("status", "playing");
166
+ }
167
+ } else {
168
+ status.value = "stopped";
169
+ emit("status", "stopped");
170
+ }
152
171
  });
153
172
  else {
154
173
  status.value = "playing";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mpegts-vue3",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "description": "Vue 3 component for mpegts.js video streaming player",
6
6
  "keywords": [
@@ -15,7 +15,7 @@
15
15
  "author": "",
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "https://github.com/huangzida/mpegts-vue3"
18
+ "url": "git+https://github.com/huangzida/mpegts-vue3.git"
19
19
  },
20
20
  "main": "./dist/index.cjs",
21
21
  "module": "./dist/index.js",