Skip to content

Commit 3d309c2

Browse files
authored
Merge pull request #1098 from basics/feature/added-missing-revoke
fix(entry): added revoke
2 parents 66de98e + 89ce7df commit 3d309c2

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

playground/nuxt.config.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,12 @@ export default defineNuxtConfig(async () => {
133133
// inlineStyles: true
134134
// },
135135

136-
detection: {
137-
performance: true,
138-
browserSupport: true
139-
},
136+
// detection: {
137+
// performance: true,
138+
// browserSupport: true,
139+
// battery: true
140+
// },
141+
140142
performanceMetrics: {
141143
device: {
142144
hardwareConcurrency: { min: 2, max: 48 },

src/runtime/utils/entry.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,19 @@ const isBatteryLow = async () => {
9292
*
9393
* In this case no video will be played automatically and play throws an error.
9494
*/
95-
export const canVideoPlay = blob => {
96-
const video = document.createElement('video');
97-
video.muted = true;
98-
video.playsinline = true;
99-
video.src = URL.createObjectURL(blob);
100-
return video.play();
95+
export const canVideoPlay = async blob => {
96+
const objectUrl = URL.createObjectURL(blob);
97+
try {
98+
const video = document.createElement('video');
99+
video.muted = true;
100+
video.playsinline = true;
101+
video.src = objectUrl;
102+
await video.play();
103+
URL.revokeObjectURL(objectUrl);
104+
} catch (error) {
105+
URL.revokeObjectURL(objectUrl);
106+
throw error;
107+
}
101108
};
102109

103110
export const deprecationWarningButtonSelector = initApp => {

0 commit comments

Comments
 (0)