Daniel Brötzmann pushed to branch master at gajim / gajim

Commits:

1 changed file:

Changes:

  • gajim/gtk/preview_audio.py
    ... ... @@ -17,6 +17,7 @@
    17 17
     from typing import Any
    
    18 18
     
    
    19 19
     import logging
    
    20
    +import sys
    
    20 21
     from pathlib import Path
    
    21 22
     
    
    22 23
     from gi.repository import Gdk
    
    ... ... @@ -207,7 +208,15 @@ def _setup_audio_player(self, file_path: Path) -> None:
    207 208
                 assert audioconvert is not None
    
    208 209
                 assert scaletempo is not None
    
    209 210
                 assert audioresample is not None
    
    210
    -            autoaudiosink.set_property('sync', False)
    
    211
    +
    
    212
    +            # On Windows the first fraction of an audio
    
    213
    +            # would not play if not synced.
    
    214
    +            # On Linux there can be a delay before playback starts with sync,
    
    215
    +            # which is however not the case on Windows.
    
    216
    +            if sys.platform == 'win32':
    
    217
    +                autoaudiosink.set_property('sync', True)
    
    218
    +            else:
    
    219
    +                autoaudiosink.set_property('sync', False)
    
    211 220
     
    
    212 221
                 audio_sink.add(audioconvert)
    
    213 222
                 audio_sink.add(scaletempo)