zoom.mdx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. ---
  2. slug: /zoom
  3. ---
  4. import Tabs from '@theme/Tabs';
  5. import TabItem from '@theme/TabItem';
  6. import UppyCdnExample from '/src/components/UppyCdnExample';
  7. # Zoom
  8. The `@uppy/zoom` plugin lets users import files from their
  9. [Zoom](https://zoom.com) account.
  10. :::tip
  11. [Try out the live example](/examples) or take it for a spin in
  12. [StackBlitz](https://stackblitz.com/edit/vitejs-vite-zaqyaf?file=main.js).
  13. :::
  14. ## When should I use this?
  15. When you want to let users import files from their [Zoom](https://zoom.com)
  16. account.
  17. A [Companion](/docs/companion) instance is required for the Zoom plugin to work.
  18. Companion handles authentication with Zoom, downloads the files, and uploads
  19. them to the destination. This saves the user bandwidth, especially helpful if
  20. they are on a mobile connection.
  21. You can self-host Companion or get a hosted version with any
  22. [Transloadit plan](https://transloadit.com/pricing/).
  23. <Tabs>
  24. <TabItem value="npm" label="NPM" default>
  25. ```shell
  26. npm install @uppy/zoom
  27. ```
  28. </TabItem>
  29. <TabItem value="yarn" label="Yarn">
  30. ```shell
  31. yarn add @uppy/zoom
  32. ```
  33. </TabItem>
  34. <TabItem value="cdn" label="CDN">
  35. <UppyCdnExample>
  36. {`
  37. import { Uppy, Zoom } from "{{UPPY_JS_URL}}"
  38. const uppy = new Uppy()
  39. uppy.use(Zoom, {
  40. // Options
  41. })
  42. `}
  43. </UppyCdnExample>
  44. </TabItem>
  45. </Tabs>
  46. ## Use
  47. Using Zoom requires setup in both Uppy and Companion.
  48. ### Use in Uppy
  49. ```js {10-13} showLineNumbers
  50. import Uppy from '@uppy/core';
  51. import Dashboard from '@uppy/dashboard';
  52. import Zoom from '@uppy/zoom';
  53. import '@uppy/core/dist/style.min.css';
  54. import '@uppy/dashboard/dist/style.min.css';
  55. new Uppy().use(Dashboard, { inline: true, target: '#dashboard' }).use(Zoom, {
  56. target: Dashboard,
  57. companionUrl: 'https://your-companion.com',
  58. });
  59. ```
  60. ### Use in Companion
  61. Configure the Zoom key and secret. With the standalone Companion server, specify
  62. environment variables:
  63. ```shell
  64. export COMPANION_ZOOM_KEY="Zoom API key"
  65. export COMPANION_ZOOM_SECRET="Zoom API secret"
  66. ```
  67. When using the Companion Node.js API, configure these options:
  68. ```js
  69. companion.app({
  70. providerOptions: {
  71. zoom: {
  72. key: 'Zoom API key',
  73. secret: 'Zoom API secret',
  74. },
  75. },
  76. });
  77. ```
  78. ## API
  79. ### Options
  80. #### `id`
  81. A unique identifier for this plugin (`string`, default: `'Zoom'`).
  82. #### `title`
  83. Title / name shown in the UI, such as Dashboard tabs (`string`, default:
  84. `'Zoom'`).
  85. #### `target`
  86. DOM element, CSS selector, or plugin to place the drag and drop area into
  87. (`string` or `Element`, default: `null`).
  88. #### `companionUrl`
  89. URL to a [Companion](/docs/companion) instance (`string`, default: `null`).
  90. #### `companionHeaders`
  91. Custom headers that should be sent along to [Companion](/docs/companion) on
  92. every request (`Object`, default: `{}`).
  93. #### `companionAllowedHosts`
  94. The valid and authorised URL(s) from which OAuth responses should be accepted
  95. (`string` or `RegExp` or `Array`, default: `companionUrl`).
  96. This value can be a `string`, a `RegExp` pattern, or an `Array` of both. This is
  97. useful when you have your [Companion](/docs/companion) running on several hosts.
  98. Otherwise, the default value should do fine.
  99. #### `companionCookiesRule`
  100. This option correlates to the
  101. [RequestCredentials value](https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials)
  102. (`string`, default: `'same-origin'`).
  103. This tells the plugin whether to send cookies to [Companion](/docs/companion).
  104. #### `locale`
  105. ```js
  106. export default {
  107. strings: {
  108. pluginNameZoom: 'Zoom',
  109. },
  110. };
  111. ```