# I want to update source(video url) on my react native app

**URL:** <https://community.bitmovin.com/t/i-want-to-update-source-video-url-on-my-react-native-app/3311>\
**Category:** Support\
**Tags:** bitmovin-player, android, bitmovin, react-native\
**Created:** [September 26, 2024, 10:08am UTC](https://community.bitmovin.com/t/i-want-to-update-source-video-url-on-my-react-native-app/3311 "2024-09-26T10:08:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fulldev0526](https://avatars.discourse-cdn.com/v4/letter/f/ac91a4/32.png) [@fulldev0526](https://community.bitmovin.com/u/fulldev0526)\
**Post date:** [September 26, 2024, 10:08am UTC](https://community.bitmovin.com/t/i-want-to-update-source-video-url-on-my-react-native-app/3311/1 "2024-09-26T10:08:44Z")

</div>

### Product

Player

### Question

player.load({  
url: channelData.url,  
type: SourceType.HLS,  
title: channelData.name,  
metadata: { platform: Platform.OS },  
});  
It’s my code base.

I am working on a react-native app and need to update the URL. It is now hooked with useEffect() but the player is stopped after an update of the state.

I hope you guide me for update of source

Thank you.

---

<div class="post-metadata">

**Author:** ![roland.kakonyi](https://sea1.discourse-cdn.com/flex015/user_avatar/community.bitmovin.com/roland.kakonyi/32/177_2.png) [@roland.kakonyi](https://community.bitmovin.com/u/roland.kakonyi)\
**Post date:** [September 30, 2024, 7:13am UTC](https://community.bitmovin.com/t/i-want-to-update-source-video-url-on-my-react-native-app/3311/2 "2024-09-30T07:13:08Z")

</div>

Hi @fulldev0526 !

Usually calling `player.load()` inside of `useEffect()` works as long as all the used variables/parameters are part of the `useEffect`’s dependencies array.

If you update the URL and a new load of `player.load()` happens, the player is meant to be stopped, as any call to `player.load()` means resetting internal state of the player and load the given source.

One source of an unwanted call might happen in case `channelData` changes but the `url` property doesn’t.

In this case you have to separate state, at least locally, by capturing `channelData.url` and `channelData.name` outside of the `useEffect` in local variables and use them for the `useEffect`’s dependencies.

Like:

```ts
const channelUrl = channelData.url
const channelName = channelData.name
useEffect(() => {
  player.load({
    url: channelUrl,
    type: SourceType.HLS,
    title: channelName,
    metadata: { platform: Platform.OS },
  });
}, [player, channelUrl, channelName]);

```

I hope this helps!

---

<div class="post-metadata">

**Author:** ![fulldev0526](https://avatars.discourse-cdn.com/v4/letter/f/ac91a4/32.png) [@fulldev0526](https://community.bitmovin.com/u/fulldev0526)\
**Post date:** [September 30, 2024, 7:53am UTC](https://community.bitmovin.com/t/i-want-to-update-source-video-url-on-my-react-native-app/3311/3 "2024-09-30T07:53:42Z")

</div>

Can we book a quick call today?

---

<div class="post-metadata">

**Author:** ![roland.kakonyi](https://sea1.discourse-cdn.com/flex015/user_avatar/community.bitmovin.com/roland.kakonyi/32/177_2.png) [@roland.kakonyi](https://community.bitmovin.com/u/roland.kakonyi)\
**Post date:** [September 30, 2024, 10:24am UTC](https://community.bitmovin.com/t/i-want-to-update-source-video-url-on-my-react-native-app/3311/4 "2024-09-30T10:24:13Z")

</div>

Unfortunately we cannot offer a call.

Did you try the proposed solution?

You can also browse our open source example application here: [bitmovin-player-react-native/example at development · bitmovin/bitmovin-player-react-native · GitHub](https://github.com/bitmovin/bitmovin-player-react-native/tree/development/example)

---

<div class="post-metadata">

**Author:** ![fulldev0526](https://avatars.discourse-cdn.com/v4/letter/f/ac91a4/32.png) [@fulldev0526](https://community.bitmovin.com/u/fulldev0526)\
**Post date:** [September 30, 2024, 4:20pm UTC](https://community.bitmovin.com/t/i-want-to-update-source-video-url-on-my-react-native-app/3311/5 "2024-09-30T16:20:54Z")

</div>

No worries. But could you clarify why it happened?

 ![image.png](https://us1.discourse-cdn.com/flex015/uploads/bitmovin/original/1X/cb845fa4ea10cf7fcfebf2572684064e8a556ab0.png)
