We have the API in libwebrtc to do that.
Created attachment 348979 [details] Patch
Comment on attachment 348979 [details] Patch Attachment 348979 [details] did not pass mac-wk2-ews (mac-wk2): Output: https://webkit-queues.webkit.org/results/9107770 New failing tests: accessibility/smart-invert-reference.html
Created attachment 348988 [details] Archive of layout-test-results from ews106 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
Comment on attachment 348979 [details] Patch unrelated error
Comment on attachment 348979 [details] Patch Clearing flags on attachment: 348979 Committed r235719: <https://trac.webkit.org/changeset/235719>
All reviewed patches have been landed. Closing bug.
<rdar://problem/44167557>