We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10529
    • 73 Posts
    I downloaded the gddflvplayer snippet and am attempting to set the TV up to pull in a specific file

    [[gddflvplayer? &width=`600` &height=`338` &flv=`[*video*]`]]


    the file is /public_html/assets/flash/Promo.flv I have set the TV up as Input Type File and have the following in Default Value @FILE ../assets/flash/Promo.flv but can not get the .flv to be pulled in see http://www.dementiacarematters.com/sue.html

    And have tried various configurations of the above - so what am I missing?

    Thanks in advance
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Try /assets/flash/Promo.flv without the leading ..
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 10529
        • 73 Posts
        Thanks for the response and I did try various configurations of ../ or / etc

        I changed the .flv to just a simple .jpg so --> @FILE /assets/flash/intro.jpg and this is the response back on the page Could not retrieve document ’/assets/flash/intro.jpg’

        I note the quotes is this I wonder something to do with magic quotes a problem I have had with permissions in the past?

        Further Edit- Have tried this on another server that does not have any magic quotes issue and the same occurs
          • 8609
          • 607 Posts
          Try removing that leading slash before assets, i.e.

          /assets/flash/Promo.flv should be assets/flash/Promo.flv
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Sorry, I was half-asleep when responding. @FILE returns the contents of the specified file using fgets(). All you want is the filename itself. That’s what a file input type TV produces; just the filename with path, not the contents of the file. Your default value should just be the filename, no @FILE.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 10529
              • 73 Posts
              sorry I’m getting now where fast and I’m now confused - you say just the filename & not the contents & Your default value should just be the filename, no @FILE.

              Please explain as it’s escaping my simple logic embarrassed


              I have also loaded a smaller flv file for testing, so if the file is in public_html/assets/flash/Heli.flv I’ve tried this and it crashes the browser @FILE assets/flash/Heli.flv when I have this on the page [[gddflvplayer? &width=`758` &height=`426` &flv=`[*video*]`]]

              I also tried the File Base Path /home/dementia/public_html/assets/ I wonder if it’s the snippet?

              <?php
              # Set Snippet Paths 
              $snippetPath = $modx->config['base_path'] . "assets/snippets/";
              
              # check if inside manager
              if ($m = $modx->insideManager()) {
              	return ''; # don't go any further when inside manager
              }
              
              # Snippet customize settings
              $flv	        = isset($flv)? $flv:0;
              $width	= isset($width)? $width:758;
              $height	= isset($height)? $height:426;
              $autoplay	= isset($autoplay)? $autoplay:'false';
              
              
              $player .= "<object width=" . $width . " height=" . $height . " data=\"" .  $modx->config['base_url']  . "assets/snippets/gddflvplayer/gddflvplayer.swf\" type=\"application/x-shockwave-flash\">";
              $player .= "<param name=\"flashvars\" value=\"&autoplay=" . $autoplay . "&sound=70&desc=&buffer=5";
              $player .= "&splashscreen=" . $modx->config['base_url'] . "assets/images/video_splash.jpg";
              $player .= "&vdo=" . $modx->config['base_url'] . $flv . "\" />";
              $player .= "<param name=\"src\" value=\"" . $modx->config['base_url']  . "assets/snippets/gddflvplayer/gddflvplayer.swf\" />";
              $player .= "<param name=\"wmode\" value=\"transparent\" />";
              $player .= "<param name=\"allowfullscreen\" value=\"true\" />";
              $player .= "<param name=\"quality\" value=\"best\" />";
              $player .= "</object>";
              
              # Return
              return $player;
              ?>
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                You do NOT want to use the @FILE binding here. All you want the TV to return is the file’s path. @FILE binding returns the contents of the file. If it were a text file containing the text "Now is the time for all good men to come to the aid of their party", that text is what would be inserted into the page. What you want is the file’s path to be inserted into the page so the player can load it. By using @FILE what you are doing is telling the TV to open the file and insert the file’s contents into the page! The browser won’t like that at all.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 10529
                  • 73 Posts
                  That would make sense then as to why the browser is crashing sad

                  So how do I go about creating the TV to hold the file path - what options should I use in this instance?

                  Ironically I have this working by using a chunk embedding the flv here http://www.dementiacarematters.com/test.html

                  But I would like to get to the bottom of what I’m doing wrong with the TV, you probably know what I mean, some bizarre masochistic ritual of trying to solve a puzzle!
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    I presume you want different files played for different pages? If that is correct, then the TV should be a file type (unfortunately there is no "video" type that would access the assets/flash folder), and the default should just be the path to the default video to play if nothing else is selected. The TV would return the path to the file. You may need to add parts of the path in the HTML code for the player if the relative path provided by the TV isn’t acceptable to it. Sometimes those can be a real pain figuring out just what kind of a path they want.

                    What I did for one site that I wanted to do this with (using Flowplayer) was to name the files after the page alias, and used a snippet to check if such a file did exist and to return the default file’s name if there wasn’t one. The code in the chunk had most of the path, just the filename part was provided by the return value of the snippet.

                    If you are selecting between a set number of video files, you could use a radio button with again just the file name being supplied by the TV, and the default value being the filename of the default video. Again, most of the path would be in the chunk containing the player code, the TV would only supply the name part of the file.
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org