Method inside Coroutine returning IEnumerator

I have the following code:

    public override IEnumerator onTriggering(){
            //some code
		AudioSource audioSource = speakText ("001", "Player");
		while(audioSource.isPlaying){
			yield return new WaitForSeconds(0.5f);
		}    
            //some code
	}

I wondered how I can put the speakText-call and the while-loop into a method without starting a new coroutine (I can’t just use a normal method, retruning void, since I return a WaitForSeconds). If this would be C++ the solution would probably be using a macro, but it’s C# and I have no idea where to go. Any suggestions?

and wondered how I could put the following part into a method

You can nest coroutines, but the inner call must also use both yield and StartCoroutine:

void Start() {
    StartCoroutine(Outer());
}

IEnumerator Outer() {
    Debug.Log("Begin Outer");
    yield return StartCoroutine(Inner());
    Debug.Log("End Outer");
}

IEnumerator Inner() {
    Debug.Log("Begin Inner");
    yield return new WaitForSeconds(3f);
    Debug.Log("End Inner");
}

I haven’t tried this in UnityScript; since it handles coroutines more “automatically”, it might still do so with nested coroutines.

I see no reason why you couldn’t call another method that returns an IEnumerator, return the value, and then return that value again in your yield. Never tried it myself. Something like this.

public override IEnumerator onTriggering(){
    IEnumerator waitTime = MyMethod();
    yield return waitTime;
    // Do something interesting
}

private IEnumerator MyMethod(){
    // Do something interesting
    return new WaitForSeconds(0.5f);
}