> For the complete documentation index, see [llms.txt](https://docs.webtonative.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.webtonative.com/javascript-apis/media-player-1.md).

# Media Player

{% hint style="info" %}
You'll need to import the javascript file in your website before starting from this [link](/javascript-apis/getting-started.md).
{% endhint %}

Functions required to have a media player like notification and control it in Android and iOS devices.

### Start Media

To start the media with controls call the function.

{% tabs %}
{% tab title="Plain JS" %}

<pre class="language-javascript"><code class="lang-javascript"><strong>window.WTN.MediaPlayer.playMedia({
</strong>    url:"Your Media URL",
    imageUrl:"Custom Image that should be shown in the notifcation"
})
</code></pre>

{% endtab %}

{% tab title="ES 6+" %}

```javascript
import { playMedia } from "webtonative/MediaPlayer";

playMedia({
    url:"Your Media URL",
    imageUrl:"Custom Image that should be shown in the notifcation"
})
```

{% endtab %}
{% endtabs %}

image (optional) : It's an optional parameter to show the image in notification else default image will be shown.

### Pause Media

{% tabs %}
{% tab title="Plain JS" %}

<pre class="language-javascript"><code class="lang-javascript"><strong>window.WTN.MediaPlayer.pauseMedia();
</strong></code></pre>

{% endtab %}

{% tab title="ES 6+" %}

```javascript
import { pauseMedia } from "webtonative/MediaPlayer";

pauseMedia();
```

{% endtab %}
{% endtabs %}

### Stop Media

{% tabs %}
{% tab title="Plain JS" %}

<pre class="language-javascript"><code class="lang-javascript"><strong>window.WTN.MediaPlayer.stopMedia();
</strong></code></pre>

{% endtab %}

{% tab title="ES 6+" %}

```javascript
import { stopMedia } from "webtonative/MediaPlayer";

stopMedia();
```

{% endtab %}
{% endtabs %}

\*Feature for Android was taken live on 26/09/2023\
\*Feature for iOS was taken live on 18/06/2025
