mdn / browser-compat-data

This repository contains compatibility data for Web technologies as displayed on MDN
https://developer.mozilla.org
Creative Commons Zero v1.0 Universal
4.94k stars 1.98k forks source link

api.MessagePort - <SUMMARIZE THE PROBLEM> #20980

Closed xiyuyizhi closed 11 months ago

xiyuyizhi commented 11 months ago

What type of issue is this?

Incorrect support data (example: BrowserX says "86" but support was added in "40")

What information was incorrect, unhelpful, or incomplete?

AudioData be explained as transferable object. but i postMessage AudioData from main thread to AudioWorkletNode associated AudioWorkletProcessor, it not work. like

--- main thread

const ctx = new AudioContext() await ctx.audioWorklet.addModule('./test-processor.js') const workletNode = new AudioWorkletNode(c, 'test-processor')

myWorkletNode.port.postMessage({ type: 'audioFrame', data: instance of AudioData },[transferable object])

--- audioworklet processor (test-processor.js)

class TestProcessor {

constructor (...args) {
   super(...args)

   this.port.onmessage = e => {
      // expect to recieve AudioData
   } 
}

process () {
     // do something
}

}

registerProcessor('test-processor', TestProcessor)

// but can not recieve AudioData through MessagePort(myWorkletNode.port)

What browsers does this problem apply to, if applicable?

Chromium (Chrome, Edge 79+, Opera, Samsung Internet)

What did you expect to see?

AudioData can transfer from main thread to audioworklet thread through MessagePort

Did you test this? If so, how?

Message event in audioworkleprocessor are not emit

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects

https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/postMessage

https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkletNode/port

Do you have anything more you want to share?

No response

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/MessagePort

MDN metadata

MDN page report details * Query: `api.MessagePort` * Report started: 2023-10-17T14:55:13.386Z
queengooborg commented 11 months ago

This sounds like a development help question rather than a browser compatibility issue, though it's hard to tell without a minimal reproducible example (your example omits the AudioData instance). If this is a development help question, please refer to a website like StackOverflow instead.