diff --git a/playground/nuxt.config.js b/playground/nuxt.config.js index 5d7e244ddf..3f744aaf64 100644 --- a/playground/nuxt.config.js +++ b/playground/nuxt.config.js @@ -133,10 +133,12 @@ export default defineNuxtConfig(async () => { // inlineStyles: true // }, - detection: { - performance: true, - browserSupport: true - }, + // detection: { + // performance: true, + // browserSupport: true, + // battery: true + // }, + performanceMetrics: { device: { hardwareConcurrency: { min: 2, max: 48 }, diff --git a/src/runtime/utils/entry.js b/src/runtime/utils/entry.js index eb3f854ac9..afb868bc67 100644 --- a/src/runtime/utils/entry.js +++ b/src/runtime/utils/entry.js @@ -92,12 +92,19 @@ const isBatteryLow = async () => { * * In this case no video will be played automatically and play throws an error. */ -export const canVideoPlay = blob => { - const video = document.createElement('video'); - video.muted = true; - video.playsinline = true; - video.src = URL.createObjectURL(blob); - return video.play(); +export const canVideoPlay = async blob => { + const objectUrl = URL.createObjectURL(blob); + try { + const video = document.createElement('video'); + video.muted = true; + video.playsinline = true; + video.src = objectUrl; + await video.play(); + URL.revokeObjectURL(objectUrl); + } catch (error) { + URL.revokeObjectURL(objectUrl); + throw error; + } }; export const deprecationWarningButtonSelector = initApp => {