# The operation could not be completed (CoreMediaErrorDomain error 561210739)

**URL:** <https://community.bitmovin.com/t/the-operation-could-not-be-completed-coremediaerrordomain-error-561210739/3089>\
**Category:** Support\
**Tags:** bitmovin-player, ios, bitmovin, react-native\
**Created:** [July 10, 2024, 2:46pm UTC](https://community.bitmovin.com/t/the-operation-could-not-be-completed-coremediaerrordomain-error-561210739/3089 "2024-07-10T14:46:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt.irby](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@matt.irby](https://community.bitmovin.com/u/matt.irby)\
**Post date:** [July 10, 2024, 2:46pm UTC](https://community.bitmovin.com/t/the-operation-could-not-be-completed-coremediaerrordomain-error-561210739/3089/1 "2024-07-10T14:46:28Z")

</div>

### Product

Player

### Question

Hello,

We have a React Native application that is using bitmovin-player-react-native to power our media playback capabilities. Recently we’ve been receiving a few `The operation couldn’t be completed. (CoreMediaErrorDomain error 561210739.)` errors in our app, but this issue doesn’t seem to be easily reproducible. Based on the OSStatus website ([OSStatus — Apple API Errors](https://osstatus.com/search/results?platform=all&framework=all&search=561210739)), I believe this error code is related to the AVAudioSessionErrorCodeExpiredSession error in Apple’s documentation, [AVAudioSession.ErrorCode.expiredSession | Apple Developer Documentation](https://developer.apple.com/documentation/coreaudiotypes/avaudiosessionerrorcode/avaudiosessionerrorcodeexpiredsession). This issue is only experienced on iOS devices.

I was curious if anyone had any experience with this error and what may be the root cause of it?

---

<div class="post-metadata">

**Author:** ![davidsteinacher](https://sea1.discourse-cdn.com/flex015/user_avatar/community.bitmovin.com/davidsteinacher/32/163_2.png) [@davidsteinacher](https://community.bitmovin.com/u/davidsteinacher)\
**Post date:** [July 11, 2024, 6:43am UTC](https://community.bitmovin.com/t/the-operation-could-not-be-completed-coremediaerrordomain-error-561210739/3089/2 "2024-07-11T06:43:57Z")

</div>

Hi @matt.irby

Unfortunately, the error messages from iOS are usually not very helpful. You said the issue is not easily reproducible. Does this mean you maybe have some hints on how it could be reproduced?

[OSStatus](https://osstatus.com/search/results?platform=all&framework=all&search=561210739) could be a good hint but also not always super helpful (not all error codes can be found there). If it’s really related to the `AVAudioSessionErrorCodeExpiredSession error`, do you have any custom `AVAudioSession` handling in your App?

---

<div class="post-metadata">

**Author:** ![matt.irby](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@matt.irby](https://community.bitmovin.com/u/matt.irby)\
**Post date:** [July 11, 2024, 2:47pm UTC](https://community.bitmovin.com/t/the-operation-could-not-be-completed-coremediaerrordomain-error-561210739/3089/3 "2024-07-11T14:47:17Z")

</div>

Hi David,

No, I do not actually have reproduction steps for this issue. I haven’t been able to reproduce it myself, but it is an error we have seen pop up several times in our production environment.

We did recently update our app code so that we can allow background playback. We integrated in `react-native-track-player` into the app so that we can pass metadata to this player. This is about the only change we added in as far as the code is concerned, I do not think this necessarily ties into AVAudioSession stuff – although the playback controls in the media player does have an effect on AVAudioSession.

---

<div class="post-metadata">

**Author:** ![davidsteinacher](https://sea1.discourse-cdn.com/flex015/user_avatar/community.bitmovin.com/davidsteinacher/32/163_2.png) [@davidsteinacher](https://community.bitmovin.com/u/davidsteinacher)\
**Post date:** [July 12, 2024, 7:21am UTC](https://community.bitmovin.com/t/the-operation-could-not-be-completed-coremediaerrordomain-error-561210739/3089/4 "2024-07-12T07:21:40Z")

</div>

Hi @matt.irby,

Do I understand the use case correctly that you are using the `bitmovin-player-react-native` player for video playback and `react-native-track-player` for background playback and to get the playback controls e.g. on the lock screen?

I had a quick look at the `react-native-track-player` and the underlying `SwiftAudioEx` framework, and they do use the `AVAudioSession`, but I could not find anything which could conflict with our Bitmovin iOS Player.

---

<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:** [July 18, 2024, 10:35am UTC](https://community.bitmovin.com/t/the-operation-could-not-be-completed-coremediaerrordomain-error-561210739/3089/5 "2024-07-18T10:35:32Z")

</div>

Hi @matt.irby!

One thing you could try is to remove or disable `react-native-track-player` to see if the problem still occurs to see which library might be at fault.

Another option you could try is to add this snippet to the screen where you have the player:

```ts
  useEffect(() => {
    // iOS audio session category must be set to `playback` first, otherwise playback
    // will have no audio when the device is silenced.
    // This is also required to make Picture in Picture work on iOS.
    //
    // Usually it's desireable to set the audio's category only once during your app's main component
    // initialization. This way you can guarantee that your app's audio category is properly
    // configured throughout the whole lifecycle of the application.
    AudioSession.setCategory('playback').catch((error) => {
      // Handle any native errors that might occur while setting the audio's category.
      console.log("Failed to set app's audio category to `playback`:\n", error);
    });
  });

```

This is from our example application [here](https://github.com/bitmovin/bitmovin-player-react-native/blob/38edaf41c0c917bc1c1b9e95186db2bc42e5c010/example/src/App.tsx#L68-L80).

It is recommended to set the category of the `AudioSession` to enable background playback for `bitmovin-player-react-native`.  
See [this section](https://developer.bitmovin.com/playback/docs/enabling-picture-in-picture-mode#configure-audio-session-on-app-startup) of our PiP guide (the same setup is required for background playback as for picture in picture).

Also note: you might need to add [this background mode capability](https://developer.bitmovin.com/playback/docs/enabling-picture-in-picture-mode#set-background-modes-capability) too.
