Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

help with webm files

I found this widget looking at someone else's twine code.


<<widget "video">>
<<if $args[0]>>
<<if $VidForce is 1>>
<<print '<video width="320" autoplay loop><source src="p/' + $args[0] + '.webm" type=\'video/webm; codecs="vp8, vorbis"\'></video>'>>
<<set $VidForce = 0>>
<<elseif $VidSize is "giant">>
<<print '<video width="1180" autoplay loop><source src="p/' + $args[0] + '.webm" type=\'video/webm; codecs="vp8, vorbis"\'></video>'>>
<<elseif $VidSize is "bigger">>
<<print '<video width="950" autoplay loop><source src="p/' + $args[0] + '.webm" type=\'video/webm; codecs="vp8, vorbis"\'></video>'>>
<<elseif $VidSize is "big">>
<<print '<video width="800" autoplay loop><source src="p/' + $args[0] + '.webm" type=\'video/webm; codecs="vp8, vorbis"\'></video>'>>
<<elseif $VidSize is "medium">>
<<print '<video width="650" autoplay loop><source src="p/' + $args[0] + '.webm" type=\'video/webm; codecs="vp8, vorbis"\'></video>'>>
<<elseif $VidSize is "small">>
<<print '<video width="500" autoplay loop><source src="p/' + $args[0] + '.webm" type=\'video/webm; codecs="vp8, vorbis"\'></video>'>>
<<endif>>
<</if>>
<</widget>>


In his, he managed to have this only in one passsage, and I cant seem to find how or if he call other passages to this line of code or twine does it for him. Yet in my story, for .webm files, I have to put this in each passage, and before the code, to get .webm files to play.

In his, he just has "<<set $vid = $image>><<video $vid>>" and it draws on the passage with the 'video' widget.

For my story, I can't get .webm files to work without having that block of widget text before the passage and before the
<<set $vid = $image>><<video $vid>> command.

Why is this?

Comments

  • You need to state which Story Format you are using when you ask a question, as answers can be different for each one. Based on your question I am going to assume you are using SugarCube 1.

    The <<widget>> macro's documentation explains that they need to be defined within a passage that has been assigned a widget passage tag. If you do that with that "video" widget then it will be available for use in your other passages.
  • edited July 2016
    thank you. that is what im using and ill be more explicit about that next time i ask a question. i cant seem to find it in his twine game being defined in any of the passages but the one where the widget video code resides.

    edit: im not sure I understand.

    also in the example twin game im looking at, after all of his if else statements, he has one
    <<set $vid = $image>><<video $vid>>
    to display the if/else selected image.

    For my code to work properly, the images dont load unless i put
    <<set $vid = $image>><<video $vid>>

    after each if statement, not after all of them like in the twine code im learning from.
  • He means create a new passage, name it whatever you want, tag it with widget, then paste the widget code into it. Done. You should now be able to call the widget from any other passage.
  • OKAY SO I think the video widget is defined by <<set $vid = $image>><<video $vid>>, and i do have this , but the reason perhaps i need to have it multiple times and his code does not is that i use <</if>> and he uses <<endif>> perhaps?

  • He means create a new passage, name it whatever you want, tag it with widget, then paste the widget code into it. Done. You should now be able to call the widget from any other passage.

    yea, ive had this but i cant get it to work with the passage so i had to take the code from that passage and post it into the passage it wasnt working in. i posted it at the bottom, still didnt work i think, so i posted the widget code posted in this thread at the top and it worked. it seems like i have to do this for every passage but will see.
  • tag it with widget

    maybe its because i converted the file into twine 2.0 from 1.4, but im not noticing any tags. I see the file where the original creator posted the widget code, just as I did in the problem passage i was having. but I dont see any tags. perhaps all the other passages are tagged to work with that widget in a way im not seeing..
  • In the 1.4 editing screen, underneath the box for entering the passage title there's a box for entering the tags.
  • Step by step instructions for defining that video widget and using the video widget in the Twine 2 application.

    1. Click on the green "+ Passasge" in the bottom right corner of the story editor to create a new passsage.
    2. Open the new passage in the Passage Editor.
    3. Change the new passage's name (line of text at top of dialog) to whatever you like, I name mine Widgets.
    4. Click on the "+Tag" link under the passage name to open the Passage Tag field.
    5. Type widget (all lowercase) into the Tag field and click on the tick mark to the right of it.

    6. Copy the following cut-down version of your example into the new passage's content area, I have removed the parts related to displaying the video in different sizes depending on variables and only included the 650px wide version. I have also changed it to look in a videos sub-folder for the files.
    <<widget "video">>
    <<if $args[0]>>
    <<print '<video width="650" autoplay loop><source src="videos/' + $args[0] + '.webm" type=\'video/webm; codecs="vp8, vorbis"\'></video>'>>
    <</if>>
    <</widget>>
    

    7. To use the video widget within your story you just need to call it passing in the file name of the video you want to play, do not include the sub-folder name nor the WEBM file extension in the video's file name.
    <<video "videoname">>
    
    eg. To display the "happy-dance.webm" video file stored within your "videos" sub-folder you use the following:
    
    <<video "happy-dance">>
    
Sign In or Register to comment.