# Render files in the Atlaskit Media Viewer component

**URL:** <https://community.developer.atlassian.com/t/render-files-in-the-atlaskit-media-viewer-component/58509>\
**Category:** Atlassian Developer Tools\
**Tags:** media, media-viewer, atlaskit\
**Created:** [May 22, 2022, 9:46pm UTC](https://community.developer.atlassian.com/t/render-files-in-the-atlaskit-media-viewer-component/58509 "2022-05-22T21:46:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexey.Sapon](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/alexey.sapon/32/41752_2.png) [@Alexey.Sapon](https://community.developer.atlassian.com/u/Alexey.Sapon)\
**Post date:** [May 22, 2022, 9:46pm UTC](https://community.developer.atlassian.com/t/render-files-in-the-atlaskit-media-viewer-component/58509/1 "2022-05-22T21:46:50Z")

</div>

In my app, I use the [Media Viewer component](https://atlaskit.atlassian.com/packages/media/media-viewer) from Atlaskit UI.

I can only render images with the _mediaItemType_ property with the value “_external-image_”.

> **See the code**
>
> ```auto
> import React, {useState} from 'react';
> import {IntlProvider} from 'react-intl';
> import {MediaViewer} from '@atlaskit/media-viewer';
> import './App.css';
> 
> const imageUri = 'https://war.ukraine.ua/wp-content/uploads/2022/03/shutterstock_2029545419-2.png';
> const pdfUri = 'https://www.buds.com.ua/images/Lorem_ipsum.pdf';
> 
> function App() {
> const [imageDisplayed, setImageDisplayed] = useState(false);
> const [pdfDisplayed, setPdfDisplayed] = useState(false);
> 
> const toggleImageMediaViewer = () => setImageDisplayed(prevState => !prevState);
> const togglePdfMediaViewer = () => setPdfDisplayed(prevState => !prevState);
> 
> let mediaViewer = null;
> 
> if (imageDisplayed) {
> const mediaIdentifier = {
> mediaItemType: 'external-image',
> name: 'Some image',
> dataURI: imageUri
> };
> mediaViewer = (
> <MediaViewer mediaClientConfig={{}}
> selectedItem={mediaIdentifier}
> dataSource={{list: [mediaIdentifier]}}
> collectionName={''}
> onClose={toggleImageMediaViewer}/>
> );
> } else if (pdfDisplayed) {
> const mediaIdentifier = {
> mediaItemType: 'file',
> name: 'Some PDF',
> dataURI: pdfUri
> };
> mediaViewer = (
> <MediaViewer mediaClientConfig={{}}
> selectedItem={mediaIdentifier}
> dataSource={{list: [mediaIdentifier]}}
> collectionName={''}
> onClose={togglePdfMediaViewer}/>
> );
> }
> 
> return (
> <div className="App">
> <h3>Hello Atlassian Community</h3>
> 
> <button onClick={toggleImageMediaViewer}>Show Image</button>
> <button onClick={togglePdfMediaViewer}>Show PDF</button>
> 
> <IntlProvider locale="en">
> <>
> {mediaViewer}
> </>
> </IntlProvider>
> </div>
> );
> }
> 
> export default App;
> 
> ```

or [GitHub project](https://github.com/alexiuscrow/media-viewer-atlaskit).

How can I render documents (plain texts, pdf, etc), play video & audio files in Media Viewer?

---

<div class="post-metadata">

**Author:** ![RhysDiab](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/rhysdiab/32/38004_2.png) [@RhysDiab](https://community.developer.atlassian.com/u/RhysDiab)\
**Post date:** [September 12, 2022, 6:15am UTC](https://community.developer.atlassian.com/t/render-files-in-the-atlaskit-media-viewer-component/58509/2 "2022-09-12T06:15:10Z")

</div>

Hi @Alexey.Sapon

Were you able to figure this out? Is the Media Viewer component capable of playing videos?

---

<div class="post-metadata">

**Author:** ![Alexey.Sapon](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/alexey.sapon/32/41752_2.png) [@Alexey.Sapon](https://community.developer.atlassian.com/u/Alexey.Sapon)\
**Post date:** [July 3, 2023, 5:40am UTC](https://community.developer.atlassian.com/t/render-files-in-the-atlaskit-media-viewer-component/58509/3 "2023-07-03T05:40:14Z")

</div>

Hi @RhysDiab,

I meant previews for video, text, and other types. Sorry for not clarifying it right away.

---

<div class="post-metadata">

**Author:** ![remie](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/remie/32/34985_2.png) [@remie](https://community.developer.atlassian.com/u/remie)\
**Post date:** [July 3, 2023, 6:53am UTC](https://community.developer.atlassian.com/t/render-files-in-the-atlaskit-media-viewer-component/58509/4 "2023-07-03T06:53:33Z")

</div>

@Alexey.Sapon,

Long story short: you can’t. The Media Viewer is closely tied to the Media API, but the specifications of that API have not been shared by Atlassian with the Atlassian Marketplace Partners. It’s a closed source system.

You could try and reverse engineer the workings of the Media API by looking at the front-end code and by inspecting the requests made by the Media Viewer (& media card) components within the context of how they are used in the host products. But given that there is also a lot of authentication handshakes involved, I would not advice you to go down that path.

We’ve been using the Media Viewer for 2+ years now and have recently decided to move away from it as it gives more headaches both in terms of UX as well as DX (specifically compilation time).

---

<div class="post-metadata">

**Author:** ![Alexey.Sapon](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/alexey.sapon/32/41752_2.png) [@Alexey.Sapon](https://community.developer.atlassian.com/u/Alexey.Sapon)\
**Post date:** [July 3, 2023, 9:28am UTC](https://community.developer.atlassian.com/t/render-files-in-the-atlaskit-media-viewer-component/58509/5 "2023-07-03T09:28:22Z")

</div>

@remie, thank you
