4 Replies Latest reply on Oct 23, 2007 12:00 PM by ewon15

    Flash Video - Probs with NetStream.onMetaData

    ewon15
      So i have created a video player and have noticed something about the onMetaData function. I have a path to the videos as a relative path to my .swf file ( myPath = 'media/'; ) and when i test my movie, the onMetaData function does not get called. However, when everything is online, or being pulled from an absolute path ( myPath = ' http://www.mydomain.com/media'; ) it is called.

      I was just curious as to why that is...?
        • 1. Re: Flash Video - Probs with NetStream.onMetaData
          Level 7
          ewon15,

          > So i have created a video player and have noticed something
          > about the onMetaData function.

          There's an onMetaData event defined by the NetStream class. Is that the
          one you're talking about?

          > I have a path to the videos as a relative path to my .swf file
          > ( myPath = 'media/'; ) and when i test my movie, the onMetaData
          > function does not get called.

          Does your FLV file have metadata in it?

          > However, when everything is online, or being pulled from
          > an absolute path ( myPath = ' http://www.mydomain.com/media'; )
          > it is called.

          Hrrm. Well, I've not experience that before. What version of
          ActionScript are you using? How have you been testing that the onMetaData
          event isn't dispatched?


          David Stiller
          Co-author, Foundation Flash CS3 for Designers
          http://tinyurl.com/2k29mj
          "Luck is the residue of good design."


          • 2. Re: Flash Video - Probs with NetStream.onMetaData
            ewon15 Level 1
            well i'm using actionscript 2.0 ... i have not had a chance to dive into AS3. I've taught my self most everything and so i probably don't know the best way to do things...

            I can't remember where i found a tutorial, i may have simply used the livedocs for flash 8 and built from it... i'm not sure what you mean when you ask me if there is metadata in my FLV...but the way i know the onMetaData method of the NetStream class was not being dispatched was by the timer and scrubber i set up...plus i put a trace in the method and it was not outputting anything...

            here's the gist of my code:

            • 3. Re: Flash Video - Probs with NetStream.onMetaData
              Level 7
              ewon15,

              > well i'm using actionscript 2.0 ... i have not had a chance
              > to dive into AS3.

              No worries. :) It just makes a difference in regard to whatever
              snippets or samples would be helpful to you.

              > i'm not sure what you mean when you ask me if there is
              > metadata in my FLV...

              When the FLV file is encoded, it may or may not have additional
              information -- the metadata -- embedded into it. MP3 files, for example,
              mainly contain audio recordings, but they have the capability of also
              containing metadata a such as copyright date, the recording artist's name,
              etc. If your FLV has no metadata, then the NetStream.onMetaData event won't
              be prompted to do anything.

              > but the way i know the onMetaData method of the NetStream
              > class was not being dispatched was by the timer and scrubber
              > i set up...plus i put a trace in the method and it was not outputting
              > anything...

              Sometimes it helps to trace more than just the value of a given object.
              It's possible, for example, that the trace() is indeed putting content to
              the Output panel, but maybe that content is an empty string.

              > here's the gist of my code:
              > [lots of code ...]

              Aha. So your trace is "hello," which should certainly be visible in the
              Output panel -- provided the FLV file has metadata. That's good. And
              you're saying that everything works with absolute paths, but not relative
              paths? That makes me wonder if the relative path is hitting the video file
              at all. (Of course, it would presumably be obvious if not, because you
              wouldn't see the video at all.)

              A quick glance at your code doesn't reveal to me anything outright
              wrong. Some of that code looks like it was suggested by one of my blog
              articles, but I can't be sure of that. (I was going to refer you to my
              blog, but I didn't want to send you on a wild goose chase, if you'd already
              come from there.)

              My general approach, when I run into something baffling like this, is to
              isolate the problem area in a separate FLA, so I can study it without the
              distraction of the rest of the code. Here's a quick snippet from the Help
              docs, for example ...

              var nc:NetConnection = new NetConnection();
              nc.connect(null);
              var ns:NetStream = new NetStream(nc);

              ns.onMetaData = function(infoObject:Object) {
              for (var propName:String in infoObject) {
              trace(propName + " = " + infoObject[propName]);
              }
              };

              ns.play(" http://www.helpexamples.com/flash/video/water.flv");

              Paste that into a new FLV, test the SWF, and see if you get output in
              your Output panel. You should. Then save that new FLA into the same folder
              as your existing work and change the absolute path of that Adobe file to the
              absolute path of one of your own. See if the same sort of output appears in
              your Output panel. It should. If it doesn't, that means your FLV doesn't
              have metadata. If it does, remove the URL portion and see if it still works
              locally for the same FLV (your FLV), but with a relative path.


              David Stiller
              Adobe Community Expert
              Dev blog, http://www.quip.net/blog/
              "Luck is the residue of good design."


              • 4. Flash Video - Probs with NetStream.onMetaData
                ewon15 Level 1
                I figured it out!

                So, a little background — I created this video player because a client of mine wanted to take their hour long PowerPoint (with sound and video) and put it online in Flash. I figured the best way to do this was to take the PowerPoint, convert it into a video file and utilize Flash as the means of which to display and control it online. Long story short, during this testing time, the videos I downloaded offline had metadata already encrypted in them, the videos I made did not have any metadata and therefore Flash could not determine the length, etc. I will have to figure out how to add metadata...

                With that said, have you ever converted PPT to video before? Is there a high quality product out there that you would recommend? I used Wondershare http://www.sameshow.com/powerpoint-to-video.html?gclid=CPDgzfzth48CFR-BQAodXCl9kA)
                and had some success, though the quality is not quite up to par.

                Thank you very much for all of your helpful comments. I greatly appreciate it.