Back to the Shapespark home page

Add button to lower right for a youtube movie?

Is there a way with the body-end.html to add a button that upon click opens a youtube video in a window in the scene?

A custom menu button can be added like this.
To open a window popup in a scene when a button is clicked check Displaying HTML pop-ups section of the API documentation.

Okay, I haven’t had any luck trying to cobble together code from the post. If there is anyone out here with some coding knowledge that can help, I assume it wouldn’t take more than 15 minutes max to code, then please message me and let me know the cost and we can take it from there. Thanks!

Perhaps the code could be pasted just like the link jan sent but change the url to be a YouTube one?

<script>
  var viewer = WALK.getViewer();
  var button = viewer.addMenuButton(
      'https://cdnjs.cloudflare.com/ajax/libs/webicons/2.0.0/webicons/webicon-facebook.png');
  button.addEventListener('click', function() {
      viewer.openUrl(
          'LINK_GOES_HERE', true)
  });
</script>

Replace LINK_GOES_HERE with:
The src part of a YouTube iframe (On a YouTube page, Click share, then Embed button)?
<iframe width="560" height="315" src="**https://www.youtube.com/embed/TtUG5s-mTF8**" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Perhaps:
LINK_GOES_HERE=https://www.youtube.com/embed/TtUG5s-mTF8

or
Perhaps the direct share link from clicking Share?
LINK_GOES_HERE=https://youtu.be/TtUG5s-mTF8

1 Like

Ill try this now, thank you!!