MediaSensor and MediaControl

This part presents how to control audio and video playing.
MediaSensor and MediaControl nodes can be used with audio and video nodes (MovieTexture and AudioClip).

Important:
Before, read basic audio/video tutorial.


Use a MeMo Player with audio and video support.
See basic audio/video tutorial for more informations.

MediaSensor node return information about playing progression.
MediaSensor interface:


See MediaSensor documentation for more informations about fields.


In first time we create a text node to display status and progression.

Note:
in a real widget, we can use a progress bar. See prototype tutorial.


We add a MovieTexture node to display video.

Note:
Add video nodes before previous text nodes.


And we add the [MediaSensor].
MediaSensor and MovieTexture have the same URL.


We add a MovieTexture node to display video.

Note:
Add video nodes before previous text nodes.


And we add the MediaSensor.
MediaSensor and MovieTexture have the same URL.


We create JavaScript node to display MediaSensor event.
We listen two events:

updateMediaProgression() function convert current time into percent value and display it.
updateMediaStatus() function display current media status.


Finally, route MediaSensor events to script functions:


Complete source code for this example:


MediaControl node control media playing.
MediaControl interface:


See MediaControl documentation for more informations about fields.