Vizard 8 » Command Index » Vizard modules » viztask » <viztask>.waitMediaEnd
8.0

<viztask>.waitMediaEnd

Wait for a media object to finish playback

<viztask>.waitMediaEnd(  
media  
)  
media
The media object to wait for

Remarks

This command will create a Condition object that will wait for the specified media object to reach the end of playback. This command does not start playback on the media, the user must manually do that.

Return Value

viztask.Condition object

Example

import viz
viz.go()

import viztask

audio = viz.add('audio.wav')

def WaitMediaEndTask():

    while True:

        yield viztask.waitKeyDown(' ')

        audio.play()

        yield viztask.waitMediaEnd(audio)

        print('Audio ended')

viztask.schedule( WaitMediaEndTask() )