W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > February 2023

[mediacapture-region] [QUESTION] How to pass CropTarget to chrome extension service worker? (#75)

From: Vova Levchenko via GitHub <sysbot+gh@w3.org>
Date: Sun, 12 Feb 2023 23:10:20 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issues.opened-1581444713-1676243418-sysbot+gh@w3.org>
wlevchenko has just created a new issue for https://github.com/w3c/mediacapture-region:

== [QUESTION] How to pass CropTarget to chrome extension service worker?  ==
I am trying to receive cropTarget from the content script in the service worker. 

`
async function getCropTarget () {
  const element = document.getElementById('crop-area')
  const cropTarget = await window.CropTarget.fromElement(element)

  return cropTarget
}
(async () => {
  const tabId = await getTabId()
  if (tabId != null) {
    chrome.scripting
      .executeScript({
        target: { tabId },
        func: getCropTarget
      })
      .then(injectionResults => {
        console.log(injectionResults)
      })
  }
})()
`

But I just received a blank object.
![image](https://user-images.githubusercontent.com/38959370/218342895-92b9c2a9-aeec-4f44-b371-e645b88ea620.png)

Do I have any chance to do this?

Please view or discuss this issue at https://github.com/w3c/mediacapture-region/issues/75 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Sunday, 12 February 2023 23:10:21 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 6 May 2023 21:20:00 UTC