Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to mute asset audio and add custom audio? #12

Open
2 tasks done
Coder-ACJHP opened this issue Mar 16, 2022 · 1 comment
Open
2 tasks done

How to mute asset audio and add custom audio? #12

Coder-ACJHP opened this issue Mar 16, 2022 · 1 comment

Comments

@Coder-ACJHP
Copy link

Coder-ACJHP commented Mar 16, 2022

Hi @ruanjx ,

First of all thank you for your effort, this is awesome framework that make work with AVFoundation easier.

  • I read documents
  • I read open or closed issues

Secondly I have a question about muting original audio of AVAsset and add custom audio to RenderComposition? I already tried to mute videoLayer with audioConfiguration like this

var audioConfiguration = AudioConfiguration()
let volumeRampTimeRange = source.selectedTimeRange
let volumeRamp1 = VolumeRamp(startVolume: 0.0, endVolume: 0.0, timeRange: volumeRampTimeRange)
audioConfiguration.volumeRamps = [volumeRamp1]
videoLayer.audioConfiguration = audioConfiguration

and then added new renderLayer for custom audio (mp3 file) named audioLayer and passed it to render composition like this

let composition = RenderComposition()
composition.layers = [videoLayer, audioLayer]

videoLayer sound plays 1 second and then its being muted, audioLayer audio works well but no video on composition entirely it becomes black screen.
Actually I couldn't see how to manage audio files in your documentation.
Any helps will be appreciated .

@Coder-ACJHP
Copy link
Author

Update
I fixed black screen issue when I add audio layer with adjusting selectedTimeRange but still original audio of video asset playing for 1 second at start even it's muted with audioConfiguration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant