Hi Josue!
Audio can be muted by using an AudioAsset
instead of Soundtrack
. You can mute the AudioAsset
by setting it’s volume to zero, and set it’s start, length and trim position like other assets.
Here is a JSON example showing how to start playing audio, then mute, then resume at the spot it was left off:
{
"timeline": {
"tracks": [
{
"clips": [
{
"asset": {
"type": "video",
"src": "https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/footage/sparks-sd.mp4"
},
"start": 0,
"length": 5
},
{
"asset": {
"type": "audio",
"src": "https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/music/unminus/palmtrees.mp3"
},
"start": 0,
"length": 2
},
{
"asset": {
"type": "audio",
"src": "https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/music/unminus/palmtrees.mp3",
"volume": 0
},
"start": 2,
"length": 1
},
{
"asset": {
"type": "audio",
"src": "https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/music/unminus/palmtrees.mp3",
"trim": 3
},
"start": 3,
"length": 2
}
]
}
]
},
"output": {
"format": "mp4",
"resolution": "sd"
}
}
The Soundtrack
property doesn’t support looping, but check out this other community post Loop/repeat a sound track for some ideas.