From 05cd749b43e890db01f2659ab8433fded71de8c7 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 13 Aug 2020 10:39:08 -0400 Subject: [PATCH 1/9] Add deviceId option to selectAudioOutput() --- index.html | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 4829ebb..d771b0c 100644 --- a/index.html +++ b/index.html @@ -256,7 +256,7 @@

MediaDevices Extensions

       partial interface MediaDevices {
-        Promise<MediaDeviceInfo> selectAudioOutput();
+        Promise<MediaDeviceInfo> selectAudioOutput(optional AudioOutputOptions options = {});
       };
       
@@ -276,6 +276,8 @@

Methods

return a promise rejected with a DOMException object whose name attribute has the value InvalidStateError.

+
  • Let options be the method's first argument.

  • +
  • Let deviceId be options.deviceId.

  • Let p be a new promise.

  • Run the following steps in parallel:

    @@ -284,6 +286,19 @@

    Methods

  • If there is no audio output device, reject p with a new DOMException whose name attribute has the value NotFoundError.

  • +
  • +

    If deviceId is not "", and + matches an id previously exposed by + selectAudioOutput in an earlier browsing + session, the user agent MAY decide to run the following + sub steps:

    +
      +
    1. +

      Let device be the device identified by deviceId.

      +
    2. +
    3. Resolve p with either deviceInfo.

    4. +
    +
  • Prompt the user to choose an audio output device, with a PermissionDescriptor named "speaker-selection".

  • @@ -307,6 +322,34 @@

    Methods

    +
    +

    AudioOutputOptions dictionary

    +

    This dictionary describe the options that can be used to obtain + access to an audio output device.

    +
    +
    dictionary AudioOutputOptions {
    +  DOMString deviceId = "";
    +};
    +
    +

    Dictionary AudioOutputOptions Members

    +
    +
    deviceId of type DOMString, defaulting to + ""
    +
    +

    When the value of this dictionary member is not "", + and matches the id previously exposed by + selectAudioOutput in an earlier session, the user + agent MAY opt to skip prompting the user in favor of resolving + with this id or a new rotated id for the same device, assuming + that device is currently available.

    +
    +
    +
    +
    +
    From ebf44be35d6234e7ec770d0220fe431d022e25c7 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 13 Aug 2020 10:43:42 -0400 Subject: [PATCH 2/9] add abort all steps. --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index d771b0c..6e75d95 100644 --- a/index.html +++ b/index.html @@ -296,7 +296,7 @@

    Methods

  • Let device be the device identified by deviceId.

  • -
  • Resolve p with either deviceInfo.

  • +
  • Resolve p with either deviceInfo and abort all steps.

  • From be6134b93231b62b50e37f6c7a53b48acd1c6f5c Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 13 Aug 2020 10:50:58 -0400 Subject: [PATCH 3/9] Remove cut'n'paste error. --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 6e75d95..3aebbbd 100644 --- a/index.html +++ b/index.html @@ -335,7 +335,7 @@

    AudioOutputOptions dictionary

    Dictionary AudioOutputOptions Members

    -
    deviceId of type deviceId of type DOMString, defaulting to ""
    From 348dc29ada55e81621436996b98a3c2b1e504cb7 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 13 Aug 2020 10:56:35 -0400 Subject: [PATCH 4/9] Fix wording around which id to resolve with. --- index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 3aebbbd..3fd1ce5 100644 --- a/index.html +++ b/index.html @@ -296,7 +296,8 @@

    Methods

  • Let device be the device identified by deviceId.

  • -
  • Resolve p with either deviceInfo and abort all steps.

  • +
  • Resolve p with either deviceId or a freshly + rotated deviceId for device, and abort all steps.

  • From 97f7bc749441215f5cd11f9abbf56190472d5fc3 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 13 Aug 2020 11:30:21 -0400 Subject: [PATCH 5/9] Fix up ordering a bit. --- index.html | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 3fd1ce5..c4b01ff 100644 --- a/index.html +++ b/index.html @@ -282,27 +282,44 @@

    Methods

  • Run the following steps in parallel:

      +
    1. Let descriptor be a PermissionDescriptor named + "speaker-selection".

      +
    2. +
    3. +

      If descriptor's + permission state is + "denied", reject + p with a new DOMException whose + name attribute has the value + NotAllowedError and abort these steps.

      +
    4. Probe the User Agent for available audio output devices.

    5. If there is no audio output device, reject p with a new DOMException whose name attribute has the value NotFoundError.

    6. -

      If deviceId is not "", and - matches an id previously exposed by +

      If deviceId is not + "" and matches an id previously exposed by selectAudioOutput in an earlier browsing - session, the user agent MAY decide to run the following - sub steps:

      + session, the user agent MAY decide, based on its previous + decision of whether to persist this id or not for this set + of origins, to run the following sub steps:

      1. -

        Let device be the device identified by deviceId.

        +

        Let device be the device identified by + deviceId.

      2. -
      3. Resolve p with either deviceId or a freshly - rotated deviceId for device, and abort all steps.

      4. +
      5. If device is available, resolve + p with either deviceId or a freshly + rotated deviceId for device, and abort the + in-parallel steps.

    7. - Prompt the user to choose an audio output device, with a PermissionDescriptor - named "speaker-selection".

    8. + Prompt the user to choose an audio output device, with + descriptor.

    9. If the result of the request is "denied", reject p with a new DOMException whose name attribute has the value NotAllowedError and abort these steps.

    10. From 9d48f4513f44cf34de6fd1dd07be28533aff297a Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 13 Aug 2020 11:49:42 -0400 Subject: [PATCH 6/9] Some nits. --- index.html | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index c4b01ff..c2a4d3f 100644 --- a/index.html +++ b/index.html @@ -293,14 +293,17 @@

      Methods

      >"denied", reject p with a new DOMException whose name attribute has the value - NotAllowedError and abort these steps.

      + NotAllowedError, and abort these steps.

    11. Probe the User Agent for available audio output devices.

    12. -
    13. If there is no audio output device, reject - p with a new DOMException whose name attribute - has the value NotFoundError.

    14. -

      If deviceId is not +

      If there is no audio output device, reject p + with a new DOMException whose name + attribute has the value NotFoundError and abort + these steps.

      +
    15. +
    16. +

      If deviceId is not "" and matches an id previously exposed by selectAudioOutput in an earlier browsing session, the user agent MAY decide, based on its previous @@ -309,18 +312,18 @@

      Methods

      1. Let device be the device identified by - deviceId.

        + deviceId, if available.

      2. If device is available, resolve p with either deviceId or a freshly - rotated deviceId for device, and abort the + rotated device id for device, and abort the in-parallel steps.

    17. Prompt the user to choose an audio output device, with descriptor.

    18. -
    19. If the result of the request is "denied", reject +

    20. If the result of the request is "denied", reject p with a new DOMException whose name attribute has the value NotAllowedError and abort these steps.

    21. Let deviceInfo be a new MediaDeviceInfo object to represent the selected audio output device.

    22. From 6665e078ff4c98c056bb4a4c73cd2844d00d7808 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 13 Aug 2020 12:53:05 -0400 Subject: [PATCH 7/9] Add fingerprinting note. --- index.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index c2a4d3f..21ad253 100644 --- a/index.html +++ b/index.html @@ -360,12 +360,19 @@

      Dictionary AudioOutputOptions Members

      "idlMemberType">DOMString, defaulting to ""
      -

      When the value of this dictionary member is not "", - and matches the id previously exposed by +

      When the value of this dictionary member + is not "", and matches the id previously exposed by selectAudioOutput in an earlier session, the user agent MAY opt to skip prompting the user in favor of resolving with this id or a new rotated id for the same device, assuming that device is currently available.

      +

      Applications that wish to rely on user agents + supporting persisted device ids must pass these through + selectAudioOutput successfully before they will + work with setSinkId. The reason for this is that it + exposes fingerprinting information, but at the risk of prompting + the user if the device is not available or the user agent + decides not to honor the device id.

  • From c3914c2dfe74a521387c5d306d65c0d33e176b03 Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 13 Aug 2020 16:57:31 -0400 Subject: [PATCH 8/9] Fix a link to permissions spec. --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 21ad253..c5a10ef 100644 --- a/index.html +++ b/index.html @@ -287,7 +287,7 @@

    Methods

  • If descriptor's - permission state is "denied", reject From ae36d7807ba50fec6fd2b9d4c499cde491df44ac Mon Sep 17 00:00:00 2001 From: Jan-Ivar Bruaroey Date: Thu, 20 Aug 2020 10:19:09 -0400 Subject: [PATCH 9/9] Update index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index c5a10ef..b7b30c6 100644 --- a/index.html +++ b/index.html @@ -345,7 +345,7 @@

    Methods

    AudioOutputOptions dictionary

    -

    This dictionary describe the options that can be used to obtain +

    This dictionary describes the options that can be used to obtain access to an audio output device.