Play and pause audio on click of material

Dear Team,

I want play and pause audio on click of mateial or object.

Please help

i want to 2 actions view change and play audio

To play/pause audio on an object click you can add the Audio extension with the Object type as the trigger Type.

If you want to perform two actions at once, the extensions won’t suit this use case. You’d need to write custom JavaScript code to control the audio playback using the browser API directly, as described in this forum post: 2 action on one click possible? - #21 by jan, and to use the switchView Shapespark API function: GitHub - shapespark/shapespark-viewer-api: JavaScript API for interacting with the Shapespark 3D scene. to switch the view.

Thank you i dnt have pogramming knowledge i use this code

var audioElement = document.createElement(‘audio’);
audioElement.src = WALK.getExtraAssetUrl(‘voice.mp3’);

WALK.getViewer().switchToView(‘product1’).play(audio);

audio not playing

I am sorry, but as described in About the Customization category we cannot help with customizing the viewer to specific needs. We can answers questions specific to the API or give hints on how a customization can be implemented, however implementing the customization is out of scope of our support.