-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(entry): added battery level check #851
Conversation
- occurs when battery is not charging and <= 20%. - added message in speedkitLayer.
src/runtime/utils/entry.mjs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we implement a generalistic solution. so it also works on ios and in desktop browsers (laptop)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two different checks.
- check battery api
- check if a video can be played without user interaction
Checking sequence
The check is placed in the entry before the performance check and triggers a separate message in the layer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the silent catch to switch to video detection.
src/module.mjs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it it helpful to create an ignore object? so we have an easy possibility to extend it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…-template-creation fix(module): remove unnecessary templates
src/runtime/utils/entry.mjs
Outdated
throw new Error('Battery is low.'); | ||
} | ||
} catch (error) { | ||
// Ignore Check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
silent catch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/runtime/utils/entry.mjs
Outdated
const VIDEO_TIMEOUT = 250; | ||
|
||
const video = document.createElement('video'); | ||
video.muted = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need that. it seems to be a duplicate -> next line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All setAttribute
have been removed and replaced with set properties.
src/runtime/utils/entry.mjs
Outdated
}, VIDEO_TIMEOUT); | ||
|
||
try { | ||
await video.play(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explain me, what should happen here in combination with the timeout.
i think we should wait for the playing event? and perhaps there is another event we can use to detect it is not playing cause of weak battery
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Video timeout was removed.
Now only the reject from the video play()
is caught.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play
- removed video timeout, only catch by play reject - added warn logs for catches - removed setAttributes, only set property
src/runtime/utils/entry.mjs
Outdated
} catch (error) { | ||
clearTimeout(timeout); | ||
throw new Error("Video playback not possible. Reason: can't play video"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please consign a meaningful error message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then there is alternatively only the possibility to forward the video error.
No separate text for an error that we can not guess when a video does not play.
src/media/video.mp4
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we use an additional file? Or can we also use a super small base64 string?
src/runtime/utils/entry.mjs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the silent catch to switch to video detection.
Any news on this? Really like to see this in v3-next. |
Hello @Object905 , will be in shortly 😉 Just planning the renaming of the package there it must be included 🙂 But will probably be available before that. |
Quality Gate failedFailed conditions |
🎉 This PR is included in version 3.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
#786