A Flash Developer Resource Site

Results 1 to 19 of 19

Thread: Playing rtmp protocol video in KoolMoves

  1. #1
    Junior Member
    Join Date
    Jul 2008
    Posts
    16

    Playing rtmp protocol video in KoolMoves

    I've been playing .flv files with no problem like this

    myvidobject.netStream.play(http://url.com/vid.flv);

    but can't get rtmp to work using:

    myvidobject.netStream.play(rtmp://url.com/vid.flv);


    I imported a .flv object and named it "myvidobject".

    Anyone here able to use rtmp?

  2. #2
    Junior Member
    Join Date
    Jul 2008
    Posts
    16
    Here's what I think is part of the solution but I need to know how to do this in Koolmoves.

    1. I try this : flv.netStream.play(rtmp://url.com/directory/vid.mp4)

    2. But I need to break this up and access the NetStream and NetConnection
    objects to format the rtmp and make it use the correct server port which I am hearing it port 443.

    3. I'm seeing info that says connect to the directory and not the video at
    first with :

    flv.netConnection.connect("rtmp://url.com/directory")

    Then play the video name as : flv.netStream.play("vid.mp4")

    But nothing I try works and it's probably because I don't understad how to use these netconnection and netStream object in koolmoves.

    No code I copied worked and I couldn't write any that worked.

    If someone can explain how to get at all the properties of these objects in
    koolmoves then I may be able to figure this out.

    Thanks

  3. #3
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    the letters before :// really are there to tell a browser of other program what protocol to use, it seems unlikely to me that you'll be able to do this. Since it's probably not a KM related issue you could try posting in the flash video forum, http://board.flashkit.com/board/forumdisplay.php?f=66

  4. #4
    Junior Member
    Join Date
    Jul 2008
    Posts
    16
    Quote Originally Posted by blanius
    the letters before :// really are there to tell a browser of other program what protocol to use, it seems unlikely to me that you'll be able to do this. Since it's probably not a KM related issue you could try posting in the flash video forum, http://board.flashkit.com/board/forumdisplay.php?f=66
    This is the solution for AS3 or AS2 :

    var connection_nc:NetConnection = new NetConnection();
    connection_nc.connect("rtmp://rtmp.myserver.com/path/folder");
    var stream_ns:NetStream = new NetStream(connection_nc);
    my_video.attachVideo(stream_ns);
    stream_ns.play("my_video");


    How do I do that in Koolmoves 6.0?

    That code does nothing if I try it in koolmoves.

    These rtmp files are playing fine in examples I've seen that were made with adobe flash with AS3.

    Thanks

  5. #5
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    Quote Originally Posted by sortie88

    That code does nothing if I try it in koolmoves.
    Nor should it. KM6 is AS1.

    On the bright side....KM7 is NOT KM6

  6. #6
    Junior Member
    Join Date
    Jul 2008
    Posts
    16
    Quote Originally Posted by Chris_Seahorn
    Nor should it. KM6 is AS1.

    On the bright side....KM7 is NOT KM6
    On the not so bright side; a guy owes me money for this player but I think I need KM7 if I ever want to collect.

  7. #7
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    You should be able to make things work with KM also.
    Unfortunately I have no experience at all with Flash Media Server.
    What's different compared to Flash is that the actual Video object is embedded in a MovieClip when you import a flv file.

  8. #8
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    did you try converting it to AS1


    var connection_nc = new NetConnection();
    connection_nc.connect("rtmp://rtmp.myserver.com/path/folder");
    var stream_ns = new NetStream(connection_nc);
    my_video.attachVideo(stream_ns);
    stream_ns.play("my_video");

  9. #9
    Junior Member
    Join Date
    Jul 2008
    Posts
    16
    Quote Originally Posted by blanius
    did you try converting it to AS1


    var connection_nc = new NetConnection();
    connection_nc.connect("rtmp://rtmp.myserver.com/path/folder");
    var stream_ns = new NetStream(connection_nc);
    my_video.attachVideo(stream_ns);
    stream_ns.play("my_video");
    Yes, I tried it so many ways that I'm sure I invented AS4 and AS5 in the process.

    I'm missing some knowledge because I was not able to play a regular http video that way either.

    The only way I personaly can get a video to play is to import a .flv;
    lets name it "inflv" then just enter only these lines of code:

    inflv.netStream.play(some.flv);
    inflv.netStream.setBufferTime(0.2);

    And that works great except for when I try to play rtmp://some.flv

    Maybe I don't understand the attachVideo part.

    I tried "inflv.attachVideo(stream_ns);" but didn't work.
    So I thought maybe I need this also "inflv = new Video();".
    Still didn't work.
    Then I tried to make the inflv a symbol; but Koolmoves doesn't allow a flv
    to be a symbol.

    I wouldn't try all that if I really new how it was supposed to work.

    Has anyone personally used the netConnection code above to play a video in Koolmoves? If so then can you tell me what part I'm missing.
    I think the code will work but I'm probably not setting up the objects correctly.

  10. #10
    undead creature necromanthus's Avatar
    Join Date
    Feb 2002
    Location
    ROM
    Posts
    1,890
    Quote Originally Posted by sortie88
    I'm missing some knowledge because I was not able to play a regular http video that way either.

    Has anyone personally used the netConnection code above to play a video in Koolmoves?
    Yes. Check out all the FLV players on http://necromanthus.com (including those embedded into NecroForum)

    Now comming back to FMS (2 or 3) and RTMP.
    The AS1 approach using Adobe Flash (8,9 or 10 beta) is the following:
    Be sure the Flash Media Server is installed & running, create a single keyframe movie, insert a Video object (flv1) and set this script in the main timeline:

    netConn = new NetConnection();
    netConn.connect("rtmp://localhost/vod/");
    netStream = new NetStream(netConn);
    flv1.attachVideo(netStream);
    netStream.play("sample");
    stop();

    That's all.

    The above script does NOT work in KoolMoves, because the Video object is not full supported:
    1) You cannot insert an empty Video object.
    You have to import an external FLV in order to get a Video object.
    Unfortunately, every time you do that, the following (invizible) piece of code is included in that keyframe:
    var netConn = new NetConnection();
    netConn.connect(null);
    var netStream = new NetStream(netConn);
    flv1.attachVideo(netStream);
    netStream.setBufferTime(5);
    netStream.play("whatever.flv");

    2) You cannot use netConn.connect("some URL here").
    Only netConn.connect(null); is supported.

    I'm sure the Video object is going to be improved in the upcoming KM version(s).

  11. #11
    Junior Member
    Join Date
    Jul 2008
    Posts
    16
    Quote Originally Posted by necromanthus
    Yes. Check out all the FLV players on http://necromanthus.com (including those embedded into NecroForum)

    Now comming back to FMS (2 or 3) and RTMP.
    The AS1 approach using Adobe Flash (8,9 or 10 beta) is the following:
    Be sure the Flash Media Server is installed & running, create a single keyframe movie, insert a Video object (flv1) and set this script in the main timeline:

    netConn = new NetConnection();
    netConn.connect("rtmp://localhost/vod/");
    netStream = new NetStream(netConn);
    flv1.attachVideo(netStream);
    netStream.play("sample");
    stop();

    That's all.

    The above script does NOT work in KoolMoves, because the Video object is not full supported:
    1) You cannot insert an empty Video object.
    You have to import an external FLV in order to get a Video object.
    Unfortunately, every time you do that, the following (invizible) piece of code is included in that keyframe:
    var netConn = new NetConnection();
    netConn.connect(null);
    var netStream = new NetStream(netConn);
    flv1.attachVideo(netStream);
    netStream.setBufferTime(5);
    netStream.play("whatever.flv");

    2) You cannot use netConn.connect("some URL here").
    Only netConn.connect(null); is supported.

    I'm sure the Video object is going to be improved in the upcoming KM version(s).
    Thanks!

    That is what I was thinking but I didn't know for sure. I had already decided that if I was going to do this I would have to use adobe flash.

    I'm still trying to figure adobe flash out.
    It's been 3 days so far.
    After downloading Koolmoves and going to your site, I built a FLV player in
    less than an hour!!

    I like using Koolmoves over adobe; it just makes the whole process smoother
    and easier at least for a beginer.

    The ease of getting things done in Koolmoves is not exagerated at all.
    KM7 is probably going to be "the bomb"!

  12. #12
    undead creature necromanthus's Avatar
    Join Date
    Feb 2002
    Location
    ROM
    Posts
    1,890
    Quote Originally Posted by sortie88
    Thanks!

    After downloading Koolmoves and going to your site, I built a FLV player in
    less than an hour!!

    I like using Koolmoves over adobe; it just makes the whole process smoother
    and easier at least for a beginer.

    The ease of getting things done in Koolmoves is not exagerated at all.
    KoolMoves is getting better and better with each release.
    But do not forget the most important "feature": $49 vs $699

    cheers

  13. #13
    Junior Member
    Join Date
    Jul 2008
    Posts
    16
    Quote Originally Posted by necromanthus
    the following (invizible) piece of code is included in that keyframe:
    var netConn = new NetConnection();
    netConn.connect(null);
    var netStream = new NetStream(netConn);
    flv1.attachVideo(netStream);
    netStream.setBufferTime(5);
    netStream.play("whatever.flv");

    2) You cannot use netConn.connect("some URL here").
    Only netConn.connect(null); is supported.

    I'm sure the Video object is going to be improved in the upcoming KM version(s).
    What if you changed that code to this :



    var netConn = new NetConnection();
    netConn.connect(KMOVERRIDEHTTP);
    var netStream = new NetStream(netConn);
    flv1.attachVideo(netStream);
    netStream.setBufferTime(5);
    netStream.play("whatever.flv");




    Then the action script in Koolmoves to play other than http would be :


    KMOVERRIDEHTTP = "rtmp://domain.com/folder";
    flv1.netStream.play(eachvid);
    KMOVERRIDEHTTP = null;




    Can someone make this change and compile a special KM version just for me?

    Hmmmmmm? Where is the "praying to all Gods at once" icon when I need it.

  14. #14
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    Are there any free streams I could use to try to get it working or is it required to have FMS myself ?

  15. #15
    Junior Member
    Join Date
    Jul 2008
    Posts
    16
    Quote Originally Posted by w.brants
    Are there any free streams I could use to try to get it working or is it required to have FMS myself ?
    I was given a couple of links to test but they are adult material.
    I can send them to you on PM if you can use them.

    They are the actual links I've been trying to play.

  16. #16
    undead creature necromanthus's Avatar
    Join Date
    Feb 2002
    Location
    ROM
    Posts
    1,890
    Quote Originally Posted by sortie88
    Where is the "praying to all Gods at once" icon when I need it.
    Here is a workaround (tested with FMS 3).
    Have FUN.
    Attached Files Attached Files

  17. #17
    Junior Member
    Join Date
    Jul 2008
    Posts
    16
    Quote Originally Posted by necromanthus
    Here is a workaround (tested with FMS 3).
    Have FUN.
    AHHHHHH! MANNNNNNN!

    Why didn't you wait until I posted my solution so I could feel smart.

    We both got to the same point a little different so there is still one issue.
    It works as long as rtmp is only shown in that player.
    If switching between http and rtmp I think it's going to require that two
    imported flv files be embeded in two different .swf files.
    So when swithing from http to rtmp the .swf with the player init will
    be removed and the other swf loaded. I haven't tried that yet so
    I'm not claiming that's a fix.

    For some reason I didn't get my code to work in the main action script
    so I put code in the impoted flv. I notice the loop in your solution so
    that may have been why I didn't get it to work your way.

    This is what I gotto work:

    import some.flv

    Select the imported flv which should be named "flv1".

    Right click flv1

    Select "edit movie clip frames"

    Select actionscript

    add this exact action script to flv1.


    myurl = _proto;
    var mynetConn = new NetConnection();
    mynetConn.connect(myurl);
    var mynetStream = new NetStream(mynetConn);
    flv1.attachVideo(mynetStream);
    mynetStream.setBufferTime(5);



    close and go up to main movie.



    select action script


    Enter this exact main action script :

    flv1._proto = "rtmp://somedomain.com/";

    playme = function() {
    clearInterval(playit);

    flv1.mynetStream.play("mp4:videonamenoextension");
    }

    playit = setInterval(playme,33);
    stop();



    Save and play.



    I'm playing h.264 high definition mp4 in my solution.

    This was actually quite exciting especially when I got it to play and I just knew someone was going to post it before me. hehehe.

  18. #18
    Junior Member
    Join Date
    Jul 2008
    Posts
    16
    Quote Originally Posted by sortie88
    If switching between http and rtmp I think it's going to require that two
    imported flv files be embeded in two different .swf files.
    So when swithing from http to rtmp the .swf with the player init will
    be removed and the other swf loaded.
    Forget about that, it's not needed.

    I just make a new netconnection when the http switches to rtmp etc...
    and that works.

    For some reason I don't have the picture anymore just the sound.
    Just a bug in all the changes I was making for sure. Probably left
    some bad code in somewhere and need to take it out.

  19. #19
    Junior Member
    Join Date
    Jul 2008
    Posts
    16
    FINAL SOLUTION:

    Don't put any action script in the imported flv(as I did before)
    Just put this player code in the main action script :

    flvfile = the video url to play
    tubecgi = flv1 that was imported




    lcflvfile = flvfile.toLowerCase();
    lcext = lcflvfile.indexOf("http://");

    if (lcext < 0)
    {

    rtmpurl = flvfile.split("/");
    rtmpvidname = rtmpurl.pop();
    rtmpfiletype = rtmpvidname.split(".");
    rtmpext = rtmpfiletype[1];
    rtmpvid = rtmpfiletype[0];
    rtmpdirectory = rtmpurl.join("/");
    tubecgi.mynetConn = new NetConnection();
    tubecgi.mynetConn.connect(rtmpdirectory);
    tubecgi.mynetStream = new NetStream(tubecgi.mynetConn);
    tubecgi.tubecgi.attachVideo(tubecgi.mynetStream);
    tubecgi.mynetStream.setBufferTime(5);
    vidout = rtmpext + ":" + rtmpvid;
    tubecgi.mynetStream.play(vidout);

    }
    else {
    tubecgi.mynetConn = new NetConnection();
    tubecgi.mynetConn.connect(null);
    tubecgi.mynetStream = new NetStream (tubecgi.mynetConn);
    tubecgi.tubecgi.attachVideo(tubecgi.mynetStream);
    tubecgi.mynetStream.setBufferTime(5);
    tubecgi.mynetStream.play(flvfile);


    }




    Notice the tubecgi.tubecgi.attachVideo().

    I kept messing that up by using only tubecgi.attachVideo().

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center