Tinderbox Training Video - Working with media in your TBX files (Part 1)
Level | Intermediate |
---|---|
Published Date | 1/1/21 |
Tags | Tinderbox, aTbRef, Images, Video, Audio, value(expression), Export Code |
Video Length | 14:39 |
URL | Tinderbox - Working with media (Part 1) - YouTube |
Example File | TBX - L Working with media (Part 1).tbx (215.8 KB) |
Revision | 1 |
TBX Version | 8.9 |
In this lesson, I discuss how to manage media files. Specifically, I show you how to embed images and reference (display and play) images, video, and audio files from your hard drive within your Tinderbox files. Referencing media, rather than embedding it, keeps your TBX file sizes to a manageable level and really helps with streamlining media file management. I also explain how to dynamically insert values from your attributes and use them in your text ($Text)†. Using the attribute value insertion method means that you won’t have to mess with your HTML each time you want to update a media file name the related configuration values (path, width, height); it will also help you in working with straight vs. curly quotes (something else I explain in the lesson).‡
NOTE: Be sure to download the sample file and play with the examples in this tutorial.
†Since recording this lesson, I’ve taken my own advice. I have created $MediaPath, $MediaDIR, $MediaWidth, and $MediaHeight attributes so that these values, like the file name, are pulled in from attributes. Another way to think about this method is to consider it a configuration setting method. This configuration method, especially when used with prototypes, enables me (and you) to change where files are stored on the hard drive. I can update the paths without the headache of having to manually change the values in every related note within Tinderbox. I can simply update the related prototypes or apply stamps to update all my notes if and when I change my file paths on my hard drive. I’ve updated the example TBX file that accompanies this lesson.
‡If you’re like me; you’ll find great value in knowing the attribute value insertion technique, also know as ^value( expression )^. You’ll learn to use it in so many different ways.
Reference materials
- aTbRef Sitemap, suggest you search for images
- W3C Schools, a research for learning HTML and the web
- Text Expander, a companion productivity software for easily inserting text snippets in any application from a library of content created by you.
- aTbef ^if( condition )^
- Master list of videos
Code Snippets
Image HTML
<img src="^value($MediaPath)^^value($MediaDIR)^^value($MediaFile)^" width="^value($MediaWidth)^" height="^value($MediaHeight)^"><br>^if($MediaCaption)^<b>^value($MediaCaption)</b>^endif^ ^if($MediaSource)^(^value($MediaSource)^)^endif^</br>
Video HTML
<video width="^value($MediaWidth)^" height="^value($MediaHeight)^" controls><source src="^value($MediaPath)^^value($MediaDIR)^^value($MediaFile)^" type="video/mp4"></Video><br>^if($MediaCaption)^<b>^value($MediaCaption)</b>^endif^ ^if($MediaSource)^(^value($MediaSource)^)^endif^</br>
Audio HTML
<audio controls><source src="^value($MediaPath)^^value($MediaDIR)^^value($MediaFile)" type="audio/mpeg"> </audio><br>^if($MediaCaption)^<b>^value($MediaCaption)</b>^endif^ ^if($MediaSource)^(^value($MediaSource)^)^endif^</br>