YT Coding help

So i am new to this but I have searched the forums multiple times and couldn't find the answer...
can i center a video on my gamebook?

i am being drove nuts by its left justifycation.


Umm... Use a bunch of spaces?
I got nothing...


This will load the video and center it:

 JS.addText ("<iframe style=\"display:block;margin:0 auto;\"  width=\"425\" height=\"344\" src=\"https://www.youtube.com/embed/cnErSx9xD_8?autoplay=1&rel=0\" frameborder=\"0\" allowfullscreen></iframe><br/><br/>")

To change which video is played:

Just enter your video's id in place of cnErSx9xD_8 in this bit:

https://www.youtube.com/embed/cnErSx9xD_8?autoplay=1&rel=0


Here's the example game.

<asl version="550">
  <include ref="GamebookCore.aslx" />
  <game name="center a video">
    <gameid>be8d1b85-38d2-4fd2-ab42-984fd08814bc</gameid>
    <version>1.0</version>
    <firstpublished>2017</firstpublished>
  </game>
  <object name="Page1">
    <inherit name="scripttext" />
    <description>This is page 1. Type a description here, and then create links to other pages below.</description>
    <options type="stringdictionary">
      <item>
        <key>Page2</key>
        <value>This link goes to page 2</value>
      </item>
      <item>
        <key>Page3</key>
        <value>And this link goes to page 3</value>
      </item>
    </options>
    <script type="script"><![CDATA[
      JS.addText ("<iframe style=\"display:block;margin:0 auto;\"  width=\"425\" height=\"344\" src=\"https://www.youtube.com/embed/cnErSx9xD_8?autoplay=1&rel=0\" frameborder=\"0\" allowfullscreen></iframe><br/><br/>")
    ]]></script>
    <object name="player">
      <inherit name="defaultplayer" />
    </object>
  </object>
  <object name="Page2">
    <description>This is page 2. Type a description here, and then create links to other pages below.</description>
  </object>
  <object name="Page3">
    <description>This is page 3. Type a description here, and then create links to other pages below.</description>
  </object>
</asl>

awesome thanks!

It seriously helped a lot thanks!!


Glad to help!

Happy gaming!


Log in to post a reply.

Support

Forums