# iOS switches video codec from "H264" to "VP8" on app state change

**URL:** <https://react-native-webrtc.discourse.group/t/ios-switches-video-codec-from-h264-to-vp8-on-app-state-change/1779>\
**Category:** General040642add70aa006ef56b5af5b5acae3\
**Created:** [June 16, 2023, 10:32pm UTC](https://react-native-webrtc.discourse.group/t/ios-switches-video-codec-from-h264-to-vp8-on-app-state-change/1779 "2023-06-16T22:32:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonkeyKing](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jonkeyKing](https://react-native-webrtc.discourse.group/u/jonkeyKing)\
**Post date:** [June 16, 2023, 10:32pm UTC](https://react-native-webrtc.discourse.group/t/ios-switches-video-codec-from-h264-to-vp8-on-app-state-change/1779/1 "2023-06-16T22:32:42Z")

</div>

When app state changes from “background” to “foreground”. iOS seems to change video codec from “H264” to “VP8” on it’s own.

I’m using Kurento Media server and peer connection gets disconnected because it cannot sync the video track.

Kurrento Server Logs

```auto
error rtpsynchronizer           
kmsrtpsynchronizer.c:454 
kms_rtp_synchronizer_process_rtp_buffer_mapped() 
<KmsRtpSynchronizer@0x7fbe58012790>  
Unknown PT: 100, expected: 96

```

PT 100 is VP8 and 96 is H264

* * *

I have tried disabling the video track before putting app to the background state and enabling when it comes back to foreground. Peer connection remains connected but when video track is enabled, kurrento server throws codec mismatch error.

Version: WebRTC 111.0.1  
Platform: iOS  
React Native: 0.69.5

---

<div class="post-metadata">

**Author:** ![8BallBomBom](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/8ballbombom/32/710_2.png) [@8BallBomBom](https://react-native-webrtc.discourse.group/u/8BallBomBom)\
**Post date:** [June 19, 2023, 7:20am UTC](https://react-native-webrtc.discourse.group/t/ios-switches-video-codec-from-h264-to-vp8-on-app-state-change/1779/2 "2023-06-19T07:20:07Z")

</div>

Bit of an unusual issue.  
Have you tried altering the SDP to force the use of the h264 codec?

---

<div class="post-metadata">

**Author:** ![jonkeyKing](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@jonkeyKing](https://react-native-webrtc.discourse.group/u/jonkeyKing)\
**Post date:** [June 20, 2023, 8:41pm UTC](https://react-native-webrtc.discourse.group/t/ios-switches-video-codec-from-h264-to-vp8-on-app-state-change/1779/3 "2023-06-20T20:41:00Z")

</div>

@8BallBomBom Yes, it works with forcing either H264 or VP8.  
But would be great to find the underlying issue here.
