Problem with playing duration

Hi,

In my smart app I am sending an audio stream to my Sonos devices.
For this purpose I use the following code:

	sonos.each {
       it.playSoundAndTrack(cleanUri(state.sound.uri, it?.currentModel), state.sound.duration, state.selectedSong, volume)
	}

Then I select 2 sonos devices to test it. The first one plays the stream with full length.
But the second one is cut in the middle.

If I remove the “state.sound.duration” and replace it with a static value (like 20), it plays well on both devices. But this time, since I can’t calculate the length of the stream, it plays twice or more.

Why does this happen ? I want to use the “state.sound.duration” value but why does it play half for the second device ?

any ideas ?

please help me