Media client
Media API Web Client Library
yarn add @atlaskit/media-client
32.0.0
Patch Changes
- Updated dependencies
Internal Media Use Only
Media Client is intended for internal use by the Media Platform and as a transitive dependency of a media package within your product.
Direct use of this component is not supported.
Consider using Media Picker instead.
Note: This component is designed for internal Atlassian development.
External contributors will be able to use this component but will not be able to submit issues.
RxJS compatibility
Media Client currently requires rxjs@^5.5.0 as peer dependency.
This package is the Media Client API Web Client Library.
Usage
import { MediaClient } from '@atlaskit/media-client';
const mediaClient = new MediaClient({ authProvider });
Media Client
Files
Using Stargate Integration
Stargate integration is enabled by default as long as an userAuthProvider
is not provided.
By default it uses the current domain as base URL. If you need to use a different base URL you can provide a stargateBaseUrl
configuration:
import { MediaClient } from '@atlaskit/media-client';
const mediaClient = new MediaClient({ authProvider, stargateBaseUrl: 'http://stargate.url' });
Sync Operations
Media Client allows sync operations by using initial Auth credentials when the consumer needs it inmediatelly after instantiation (e.g., Server Side Rendering). MediaClientConfig requires the "initialAuth" attribute to provide an Auth object that does not come from an async Auth provider.
Example:
import { MediaClient } from '@atlaskit/media-client';
const mediaClientConfig = {
authProvider: myAuthProvider,
initialAuth: myAuth
}
const mediaClient = new MediaClient(mediaClientConfig);
const imageUrl = mediaClient.getImageUrlSync(myFileId, myParams);