To create a screencast, using Quicktime player, that also captures system sounds Soundflower is the tool to use. I mentioned that after installing it you set Soundflower as your output device and when creating your screencast or audio recording select Soundflower as your input device. However, since Soundflower is your output device as you record you do not hear the audio.
With Apple Midi Setup you can create an multi-output device that allows you to send the audio to Soundflower and also to the Built-in input. This allows you to listen to the audio you are sending to Quicktime player. When ready to record you can select your multi-output device. When in quicktime select Soundflower for your input and you will be able to hear and record the audio.