Professional Web Applications Themes

Streaming Video trouble - Macromedia Flash Flashcom

Hello all, I have a fairly basic problem. I am attempting to stream a single FLV video file. The audio is all that I am able to get to play at this point. The video controls have no effect on the audio playback. Not many people seem to be having this problem from what I have read, so I am sure I am making a simple mistake, but I am stumped. Here is my code. var my_nc:NetConnection = new NetConnection(); my_nc.connect("rtmp://server_IP/testapp/dyn/"); var my_ns:NetStream = new NetStream(my_nc); myVideo.attachVideo(my_ns); my_ns.play("testapp"); // When I add .flv to testapp, the audio stops working too ...

  1. #1

    Default Streaming Video trouble

    Hello all,

    I have a fairly basic problem. I am attempting to stream a single FLV video
    file. The audio is all that I am able to get to play at this point. The video
    controls have no effect on the audio playback. Not many people seem to be
    having this problem from what I have read, so I am sure I am making a simple
    mistake, but I am stumped. Here is my code.

    var my_nc:NetConnection = new NetConnection();
    my_nc.connect("rtmp://server_IP/testapp/dyn/");
    var my_ns:NetStream = new NetStream(my_nc);

    myVideo.attachVideo(my_ns);
    my_ns.play("testapp"); // When I add .flv to testapp, the audio stops working
    too
    stop();

    The FLV is named "testapp.FLV" The video playback compenent has the instance
    name of "myVideo." The FLV is in the applications folder under
    testapp/streams/dyn/. When I test the swf in flash, it outputs this message:
    "1000: Unable to make connection to server or to find FLV on server." However,
    when I go into the fms2_console, I can see the instance is activated, and the
    FLV is "playing live."

    The samples all had a main.asc file in their apps folder. So I decided to try
    it as well.
    I put main.asc in the testapp folder that contained the code: load(
    "components.asc" );
    In the swf file, I had load("main.asc"); on the first line. I was guessing
    when I did this, but it had no effect anyway.

    Does anyone have any ideas? Much appreciated...

    mikereloaded Guest

  2. #2

    Default Re: Streaming Video trouble

    Your problem is that you're using the FLVPlayback component, where you should
    be using a video object.

    Create a new video object in your library, drag it onto the stage, and name it
    myVideo. If course, you'll need to remove or rename the flvplayback you have on
    the stage now.

    JayCharles Guest

  3. #3

    Default Re: Streaming Video trouble

    Jay,

    That worked. You are my hero...
    mikereloaded Guest

  4. #4

    Default Re: Streaming Video trouble

    As a follow up question, do you happen to know why the flvPlayback component will not work for streaming FLV content. Or does it just not work how I had it set up?
    mikereloaded Guest

  5. #5

    Default Re: Streaming Video trouble

    Your response here had me bouncing off the walls in Joy!!!
    I've been trying to figure out why My stream was only playing the sound and
    not the video.
    Your post above with regards to using a Video Object instead of a FLVPlayback
    Component solve my issue perfectly.

    My question to you is - and this may be a very novice question:
    How do i apply an FLVPlayback skin to my video that I have finally figured out
    how to stream?
    It's driving me insane and I need to set this up for a demo next week.
    Any help would be much appreciated.

    Cheers,
    CoCo

    CoCo369 Guest

  6. #6

    Default Re: Streaming Video trouble

    Unfortunately, I don't have much advice on any of the prebuilt components that
    ship with Flash, as I don't use them. I found that using the components tends
    to get in the way of what I want to do (as does using anyone else's code), so I
    prefer to build my own.

    Mikereloaded - As I understand things, the flv playback component requires a
    specific function in your main.asc (I think the method name is
    getStreamLength). Basically, the component asks the server how long the stream
    is before it loads up. If the function is missing in your main.asc, that may be
    the culprit. Look at the FMS debug panel when using the component, and see if
    it spits out a method not found error. If it does, you found the problem.


    JayCharles Guest

  7. #7

    Default Re: Streaming Video trouble

    Thanks a lot for your comments.
    I'll look into the 'getStreamLength' Method in the the Main.asc file tomorrow.
    I think I've had enough for one day - This day!!! :o)

    Cheers,
    CoCo
    CoCo369 Guest

  8. #8

    Default Re: Streaming Video trouble

    Question about the Video Object:

    Is it possible to add event listeners to the Video Object to listen for cue
    points that are attached via actionscript? Or is this function only compatible
    with the component?

    Thanks!

    knucklenutz Guest

  9. #9

    Default Re: Streaming Video trouble

    No. For that you need the onMetaData method of the netStream class.

    The cuepoints are in a metadata property aptly named 'cuePoints'. To access
    them, try this (where ns is the variable name for your netstream):

    ns["onMetaData"] = function(obj){
    cuePoints = obj.cuePoints
    }

    Now, you have an actionscript object (named cuePoints) that contains the
    cuepoints. So, what you want to do is monitor the current position of the
    playhead (the netstream time), and pick out the proper cuepoint. Here's one
    approach

    function getCuePoint(){
    currentTime = ns.time;
    a = 0;
    for (i in cuePoints) {
    if (cuePoints[i].time != undefined) {
    b = a+1;
    if ((cuePoints[a].time<=currentTime) && (cuePoints[b].time>=currentTime)) {
    nowPoint = a;
    if (nowPoint != currentCuePoint) {
    currentCuePoint = nowPoint;
    trace("Current cue point is "+nowPoint);
    }
    break;
    }
    a++;
    }
    }
    }
    }

    Now, set up an interval to check the current cuepoint every 200ms or so
    int = setInterval(this, "getCuePoint", 200);

    I'm sure there are other ways it can be done, but this has worked well for me.



    JayCharles Guest

  10. #10

    Default Re: Streaming Video trouble

    Ugh... the forum code is ing with the actionscript. Let me see if I can fix that
    JayCharles Guest

  11. #11

    Default Re: Streaming Video trouble

    No. For that you need the onMetaData method of the netStream class.

    The cuepoints are in a metadata property aptly named 'cuePoints'. To access
    them, try this (where ns is the variable name for your netstream):

    ns["onMetaData"] = function(obj){
    cuePoints = obj.cuePoints
    }

    Now, you have an actionscript object (named cuePoints) that contains the
    cuepoints. So, what you want to do is monitor the current position of the
    playhead (the netstream time), and pick out the proper cuepoint. Here's one
    approach

    currentTime = ns.time;
    ax = 0;
    for (ix in cuePoints) {
    if (cuePoints[ix].time != undefined) {
    bx = ax+1;
    if ((cuePoints[ax].time<=currentTime) && (cuePoints[bx].time>=currentTime)) {
    nowPoint = ax;
    if (nowPoint != currentCuePoint) {
    currentCuePoint = nowPoint;
    trace("Current cue point is "+nowPoint);
    }
    break;
    }
    ax++;
    }
    }
    };

    Now, set up an interval to check the current cuepoint every 200ms or so
    int = setInterval(this, "getCuePoint", 200);

    I'm sure there are other ways it can be done, but this has worked well for me.

    JayCharles Guest

  12. #12

    Default Re: Streaming Video trouble

    For those who want to use the FLVplayback component for streaming, click the following link:

    [url]http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=d244749e[/url]
    mikereloaded Guest

  13. #13

    Default Re: Streaming Video trouble

    Upon review of the "solution" to get the flvPlayback component to work, I am
    left utterly baffled. Every "answer leads to more questions. I am going in
    circles on live docs.

    I have tried to link to the XML file via content path as they have suggested.
    I have also put the main.asc into the application folder as they have suggested
    (unaltered since they don't really explain what to change). I fixed the XML
    file as well, because the sample code provided is incorrect as some of you will
    discover.

    If anyone has any luck in getting this to work, please post your methods. I
    think there are a lot of people out there who are lost in actionscript hell as
    I am.

    mikereloaded Guest

Similar Threads

  1. Streaming video
    By Jordan Marton in forum Macromedia Flash Flashcom
    Replies: 20
    Last Post: September 22nd, 08:43 PM
  2. Trouble With Video Streaming and creating a button?
    By i_luv_pitza in forum Macromedia Flash Flashcom
    Replies: 2
    Last Post: April 17th, 04:07 AM
  3. Video streaming: OK audio but video just white
    By bobmcinnis in forum Macromedia Flash Flashcom
    Replies: 2
    Last Post: March 25th, 01:25 AM
  4. Video Streaming
    By SmileyBlue in forum Macromedia Flash Flashcom
    Replies: 3
    Last Post: October 21st, 08:35 PM
  5. video streaming - swf?
    By ECO2 in forum Macromedia Flash
    Replies: 1
    Last Post: January 14th, 01:18 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139