spot: update version, unload offscreen when background is reloaded
This commit is contained in:
parent
a89eeca148
commit
d3b6511e55
3 changed files with 12 additions and 11 deletions
|
|
@ -3,7 +3,7 @@ import { WebRequest } from "webextension-polyfill";
|
|||
export default defineBackground(() => {
|
||||
const CHECK_INT = 60 * 1000;
|
||||
const PING_INT = 30 * 1000;
|
||||
const VER = '1.0.0';
|
||||
const VER = '1.0.3';
|
||||
|
||||
const messages = {
|
||||
popup: {
|
||||
|
|
@ -1126,15 +1126,16 @@ export default defineBackground(() => {
|
|||
(c: { contextType: string }) => c.contextType === "OFFSCREEN_DOCUMENT",
|
||||
);
|
||||
|
||||
if (!offscreenDocument) {
|
||||
await browser.offscreen.createDocument({
|
||||
url: "offscreen.html",
|
||||
reasons: ["DISPLAY_MEDIA", "USER_MEDIA", "BLOBS"],
|
||||
justification: "Recording from chrome.tabCapture API",
|
||||
});
|
||||
} else {
|
||||
recording = offscreenDocument.documentUrl.endsWith("#recording");
|
||||
if (offscreenDocument) {
|
||||
await browser.offscreen.closeDocument()
|
||||
}
|
||||
|
||||
await browser.offscreen.createDocument({
|
||||
url: "offscreen.html",
|
||||
reasons: ["DISPLAY_MEDIA", "USER_MEDIA", "BLOBS"],
|
||||
justification: "Recording from chrome.tabCapture API",
|
||||
});
|
||||
|
||||
return recording;
|
||||
}
|
||||
async function sendToActiveTab(message: {
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ class ScreenRecorder {
|
|||
mimeType: this.settings.mimeType,
|
||||
audioBitsPerSecond: this.settings.audioBitsPerSecond,
|
||||
videoBitsPerSecond: this.settings.videoBitsPerSecond,
|
||||
videoKeyFrameIntervalDuration: 1000,
|
||||
});
|
||||
|
||||
this.mRecorder.ondataavailable = this._handleDataAvailable;
|
||||
|
|
@ -296,7 +297,6 @@ class ScreenRecorder {
|
|||
|
||||
let recorder = new ScreenRecorder();
|
||||
recorder.init(getRecordingSettings("720p"));
|
||||
|
||||
browser.runtime.onMessage.addListener((message, _, respond) => {
|
||||
if (message.target === "offscreen") {
|
||||
if (message.type === "offscr:start-recording") {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "wxt-starter",
|
||||
"description": "manifest.json description",
|
||||
"private": true,
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "wxt",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue