Play FLV and Live Video with Flash Lite 3.0

I have made a few test with Flash Lite 3.0 and Flash Media Server 3 and I have to say that it is pretty easy to stream FLV Video files and Live Video from local web camera to mobile phone. Here are a quick instructions how to do it in Windows (I will publish Linux version later).

Play FLV-video from Flash Media Server 3:

  • Install Flash Media Server 3 (download developer version)
  • There are a few sample FLV files in applications/vod/media folder, so you can use one of them for testing
  • Create a new Flash Lite 3.0 file in Flash
  • Add a new Video symbol to library
  • Drag this Video symbol to Stage and give instance name to it: video
  • Type following programming to timeline:
// make a new video-object
var video:Video;
// make a new NetConnection-object
var nc:NetConnection = new NetConnection();

// check connection status from server
nc.onStatus = function(info:Object):Void {
  status_txt.text=info.code;
  if (info.code == "NetConnection.Connect.Success") {
    startStreaming();
  }
}

// start streaming video to phone
function startStreaming() {
  ns = new NetStream(nc);
  ns.setBufferTime(5);
  video.attachVideo(ns);
  // play sample.flv from server
  ns.play("sample",0);
}

// show info to user
status_txt.text = "Connecting server...";

// connect FMS 3 video on demand service (default port 1935)
nc.connect("rtmp://your.server.ip.here:1935/vod");
  • Go to Publish Settings...
  • Set Local playback security: Access network only
  • Publish your SWF-file
  • Send your SWF-file to your phone
  • Test and you should see FLV-video playing in your phone

Play live video from Flash Media Server 3:

  • Install Flash Media Server 3 (download developer version)
  • Install Flash Media Encoder 2 (Windows only)
  • Start Flash Media Encoder 2
  • You should see your live camera in Input screen
  • Press Start-button to start sending live video to Flash Media Server 3
  • Create a new Flash Lite 3.0 file in Flash
  • Add Video symbol and programming as you did earlier
  • Modify your programming:
// in startStreaming()-function
// Flash Media Encoder 2 publish stream name is "livestream"
ns.play("livestream",-1,-1,true);

// start connection to Flash Media Server 3
// Flash Media Encoder 2 publishes Flash Media Server's default
// live publishing point, so connect it
nc.connect("rtmp://your.server.ip.here:1935/live");
  • Publish, test and enjoy

Download sources: all

28 Responses to “Play FLV and Live Video with Flash Lite 3.0”


  1. 1 sapla

    iam a student,,
    can you tell me (step by step)
    how to create live video streaming using flashlite3 and fms3

    my email: wahyu_william@yahoo.com

  2. 2 ptm

    Hi,

    it should be easy if you follow instructions what I have wrote and when you are using Windows because Flash Media Encoder only works in Windows. Just install Flash Media Server 3 and Flash Media Encoder 2. Install your web cam and start Flash Media Encoder 2, you should see your live video in encoder. Start publishing your video to Flash Media Server 3. Encoder publish video to Flash Media Server 3 application/live folder by default. Download my sources and start Flash. Modify your own IP in Flash Lite source code and test movie, you should see your live in Flash Lite Device Central Emulator.

    Pasi

  3. 3 sapla

    i trying live video streaming using Flashlite3, FMS3 and Flash Media Encoder,,
    if i use multiple camera,,
    how to switch camera in flash lite3

  4. 4 ptm

    Good question – I havent tested it, I think you have to make two different live application to FMS and publish streams in those. In Flash Lite 3.0 just connect to stream what you want.

    Pasi

  5. 5 sapla

    thank’s with your feedback
    can you tell me step by step or example to switch camera

  6. 6 moscavi

    A little bit different from yours…I would like to send video from my nokia with flashlite (choose you which one…version and model) to a web server (and, optionally, store the video sent). Is there a solution? If yes which is the minimal configuration (less expansive and less invasive…) to realize it?
    Thanks in advance.

  7. 7 sapla

    live video using fms3 and flash lite3…

    without flash media encoder

    how to make server side script??

  8. 8 ptm

    you dont need server side script, you can use default live application

  9. 9 moscavi

    Can you give me some more specific indication, or an example I can use to start? It would be great. Thanks in advance.

  10. 10 ptm

    moscavi, you can download my source codes above. there are all files what you need. just install fms3 and encoder 2, check ip numbers in source codes and all should be good then.

    Pasi

  11. 11 moscavi

    Thanks Pasi,
    if I understand correctly, I have to use the code on top of the page, installing fms3 and encoder2,
    substituting rtmp://your.server.ip.here:1935/live
    with my server’s parameters.
    So your code should (must?) work correctly on a nokia phone with flashlite (or other device compatible) or there are exceptions?
    An other question…is there some copyright stuff with fms3 and encoder 2 on server machine?
    As usual, thanks in advance.

  12. 12 ptm

    moscavi,
    there are zip-file available below article, use it. Yes you have to install fms3 and encoder 2. Start fms3 and encoder 2 to send stream to fms3. Edit my source FLA to use your server ip and compile SWF, test in device central, should work. If you have Flash Lite 3.0 device, send SWF to it and test there also. You can use FMS 3 developer version with max 10 different connections.

    Pasi

  13. 13 moscavi

    Thanks (as many times before…) but I can’t see the files you are talking of. Can you, please, help me with these files (an address, maybe or something like that…).
    Thanks again.

  14. 14 Searching

    where can i download the flash lite 3?

  15. 15 ptm

    Developer version is available in adobe labs http://labs.adobe.com/technologies/flashlite3/

  16. 16 Eidur

    hello ptm.

    This is a great guide, I just tried it yesterday and works fine.
    I was wondering what setting you use in encoder when streaming:bitrate,fsp mostly.

    cos my video on my N95-8GB is playing like in slowmotion then skipping frames but plays fine on my pc and mac.

    any tips ?

  17. 17 ptm

    Eidur,

    I dont have any special settings in encoder, just default settings in Flash Media Encoder 2.

  18. 18 Christian

    Hi, great info, i have two problems, im seeing everything fine but i can hear the sound, im using Flash Media Server and Flash Lite 3 on a Nokia N95.

    Otherwise, does exist any way to stream video and sound with flash lite 2.0 ?
    Thanks in advance!

  19. 19 Tonydep

    Hi ptm,
    I’m an italian student and I would ask you some help with your experiment. I can install flash media server on my laptop and use it as local server, or I need a web server that support flash media?
    Thank a lot!

  20. 20 ptm

    Tonydep,

    you can use your laptop as local server and connect that ip from flash lite 3.0 application.

    Pasi

  21. 21 Horus

    Please PTM, answer to the “Sound problem”. Can we send stream on mobile phones with sound; from code? because i see is working with Media Encoder but from code, is not. please , if u have an answere for this notice me on manoleb@gmail.com

  22. 22 ptm

    Horus,

    it should work – I try to get more time to test it soon. Anyone?

    Pasi

  23. 23 BobUsingFL3

    Hi PTM, Thank you for the excellent tutorial. I am trying to write a live video app. My record code publishes the live camera video from AS. And my player code plays it from FMS3. But I found the video will show only the first Fram then freezes. I have look around some threads, this seems like a problem with FMS3 or FL3. Have you try this scenario yet? Or anybody has a solution to this? Thanks in advance.

  24. 24 dj brikz

    I got this problem in live streaming from my camera to the mobile phone. This is my setup:

    1. FME 2.5
    2. Flash Device central
    3. Red5 server

    Problem: I can broadcast the video from my local camera to the server and viewing the stream using the web is ok but if viewing the stream using the e71 device inside the flash device central the video is slow moving..sometimes freezes (displays “NetStream.Buffer.Empty” or “NetStream.Buffer.Full”). I’m afraid its the settings i used when publishing my live video. Below are the details i used.

    VIDEO:
    Size: 160×120
    Bit rate: 650 Kbps
    Fps: 15
    AUDIO:
    Format: NellyMoser (Mono)
    Sample rate: 8000 Hz
    Bit rate: 16 kbps

    Any suggested and tested video and audio settings? Once i can figure out here I’ll just post back here also. Thanks for the share in advance.

  25. 25 Vlad

    Hi,

    I’m also having some trouble. I managed to make an application for my Nokia E51, so I can view a live rtmp feed from a local TV channel.

    The only problem is, it’s working reaaaal slow on my E51. In Device Central everything is fine. On my handheld the audio is ok, but video is in slowmotion.

    Anyway I could tweak the NetStream to make it work ?
    I tried modifying the flash quality, and even with Low, the same behaviour.

  1. 1 | Flash Lite in Mobile and Embedded World
  2. 2 Play FLV video with Flash Lite 3 & Flash Media Server 3 at Kuneri bloggy
  3. 3 .byte-sm’s blog - Leonardo Risuleo » Play FLV and Live Video with Flash Lite 3.0

Leave a Reply





Get Adobe Flash playerPlugin by wpburn.com wordpress themes