You don't wait. As I said, put the code to be executed after JavaScript finished execution in a function and call that function from the callback. A call back function in Delphi terminology is an event handler..
Your app doesn't wait that the user press the "play" button. You get an event when the button is pressed and from there, you start the task you have to do, that is execute JavaScript.
Then, you don't wait for the JavaScript execution, you just return. The code to be executed (A position bar on the timeline) once JavaScript is done is called from the WebView2 callback (That is an event).
From the "play" button click event, you disable the button and you re-enable it once you get the JavaScript done.