Can't Stream File using Video object

I'm trying to get my video files to stream from my local version of flash media server to my instance of a flex application. I'm able to connect to the server and I'm receiving the NetConnection.Connect.Success code from the server. When I debug the application, I'm finding that I'm getting NetStatusEvent objects with the codes: NetStream.Play.Reset and NetStream.Play.Start. And the info object's details property is "sample.flv" which is the video file that I have sitting in my "FMSTesting" applicaiton folder. So my video is in my application folder at: "rtmp://localhost/FMSTesting/sample.flv", and my Flex application outputs to the webroot of the flash media server "http://localhost/FMSTesting/bin-debug/FMSTesting.html"
So I'm not sure if my setup is wrong or not, but I think it's ok because I can connect to the server just fine. I just can't get my stream to play on the Video object. Here's my code, please help if you can. I also attached the code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();">
<mx:Script>
<![CDATA[
import mx.core.UIComponent;
import mx.rpc.events.ResultEvent;
import flash.net.NetConnection;
import flash.net.navigateToURL;
import flash.events.NetStatusEvent;
import flash.events.StatusEvent;
import flash.text.TextField;
import flash.net.NetStream;
import flash.media.Video;
public var wrap:UIComponent;
public var nc:NetConnection;
public var ns:NetStream;
public var myVid:Video;
public function init():void{
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS,onConnect);
nc.connect("rtmp://localhost/FMSTesting","bonnetbe");
wrap = new UIComponent();
wrap.x = 10;
wrap.y = 10;
wrap.width =210;
wrap.height = 200;
//public function onSayHello(
public function onConnect(event:NetStatusEvent):void{
myText.text = "The connection is "+nc.connected + event.info.code;
switch (event.info.code)
case "NetConnection.Connect.Success":
myText.text += ("Congratulations! you're connected" + "\n");
makeVideos();
break;
case "NetConnection.Connect.Rejected":
myText.text += ("Oops! the connection was rejected" + "\n");
break;
case "NetConnection.Connect.Closed":
myText.text += ("Thanks! the connection has been closed" + "\n");
break;
public function makeVideos():void{
ns = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS,netStatusHandler);
ns.client = this;
ns.play("sample.flv");
myVid = new Video(200,180);
myVid.attachNetStream(ns);
myVid.opaqueBackground = true;
myVid.smoothing = true;
myVid.width = 200;
myVid.height = 180;
wrap.addChild(myVid);
myCanvas.addChild(wrap);
public function callClient(event:Event):void{
nc.call("magic",new Responder(myResponder,statusResponder), "World");
nc.call("moreFunc",new Responder(myResponder2,statusResponder2),"benjamin");
//myText.text+= "still connected: "+nc.connected;
public function netStatusHandler(event:NetStatusEvent):void{
trace(event);
trace(myVid.videoHeight+" : "+myVid.videoWidth);
public function myResponder(result:Object):void{
myText.text += "the result: "+result;
public function statusResponder(status:Object):void{
myText.text += "some status: "+status.code;
public function myResponder2(result:Object):void{
myText.text += "result2: "+result;
public function statusResponder2(status:Object):void{
myText.text += "status 2: "+status.code;
public function updateFunc(event:Event):void{
changeText.text = "testing: "+nc.connected;
nc.close();
]]>
</mx:Script>
<mx:TextArea id="myText" text="Hello Ben" width="271" height="155" x="311" y="138"/>
<mx:Text x="10" y="192" text="Text" width="144" height="67" id="changeText"/>
<mx:Button x="27" y="378" label="Button" id="funcCall" click="updateFunc(event);"/>
<mx:Button x="135" y="378" label="callFunc" id="callFunc" click="callClient(event);"/>
<mx:Canvas x="311" y="10" width="200" height="120" id="myCanvas"/>
<mx:VideoDisplay x="759" y="62" width="300" height="250" id="vidObj"/>
</mx:Application>

Hi,
Your code is perfectly fine except for one statement.
ns.play(
"sample.flv");
Since you want to play vod, give the stream name without extension like - ns.play("sample");
But why you got NetStream.Play.Reset and NetStream.Play.Start events? It is because you have not mentioned the 'start' and 'length' values in your ns.play() method. Which takes the default for 'start' as -2, which means that Flash Player first tries to play the live stream specified in stream_name. If a live stream of that name is not found, Flash Player plays the recorded stream specified in stream_name. If neither a live nor a recorded stream is found, Flash Player opens a live stream named stream_name, even though no one is publishing on it. When someone does begin publishing on that stream, Flash Player begins playing it.  Since you have mentioned the stream name with extension, FMS considers it as a stream which is not found in the server and started waiting for a live stream with the name 'sample.flv'.
Best practice is always give the 'start' and 'length' of the stream when calling NetStream.play() method.
Regards,
Janaki L

Similar Messages

  • SMIL File / Flash Video Object / Netstream

    Hi all!
    I have build a streaming video player bassed on the flash Video Object and netstream. The company that provides the streaming have now gone over to Dynamic Streaming and uses SMIL files. Usually this is not a problem if i had used a FLVPlayback component, But now that my player is a Video Object i just can't get it to work.
    I don't want to rebuild the entire player based on FLVPlayback component since the current play have many functions.
    Have anyone built a Dynamic player based on Video object? Anyone that can help me with this?
    Oh yeay. I use AS2  I know i'm going over to AS3 but this player in built in as2
    Looking forward to see how this can be solved

    Hi,
    I don't think there is a direct way of using SMIL files with Video Object like it can be used with FLVPlayback component.
    Also its much easier to accomplish dynamic streaming using AS3 than AS2.
    With the current AS2 implementation you might have to parse the contents of smil file store the details of different bitrate media available in the FMS app.
    Some amount of coding would be needed to leverage the QoS metrics which can be accessed from NetStream object when Flash Player 10 is used. And then based on what the metrics indicate pick an appropriate bitrate file to switch to.
    This article mentions how to use AS2 for dynamic streaming : http://www.adobe.com/devnet/flashmediaserver/articles/dynstream_actionscript.html
    Hoping to see if anyone else have tried to do it already so that it may prove helpful to you.
    In case you are looking to port your video player to AS3 , here are some useful links:
    http://www.adobe.com/devnet/flashmediaserver/articles/dynstream_advanced_pt1.html
    Now there is also an Open Source Media Framework which you can leverage to build media players easily.
    http://www.adobe.com/devnet/flash/articles/video_osmf_streaming.html
    Regards
    Mamata

  • Can not stream full hd videos from iPhoto macbook library

    Hello,
    for some reason I can not stream full hd videos from my macbook iphoto libary to apple tv3! It streams 720p videos but full hd videos taken by my camcorder are unable to watch on my apple tv, if I want to stream it directly from iphoto on my macbook.
    Any ideas what the problem could be?
    Thank you and greetz from the Black Forrest / Germany

    Hi. My camera is a Canon 600D. And yes my videos are stored in the Aperture library and they are not referenced. Even then I tried to select all the videos in Aperture and clicked 'consolidate masters' and there was a messge that said all 'none of the files are referenced',... so they didn't need consolidating.
    I also tried preferences> export> external video editor > choose > iMovie. And then right click on the video to edit with imovie. Even then the video didn't show up in iMovie. It seems like the only option for me is to import the videos directly to iMovie which means there will be two versions of the same file stored in my computer eating up space.
    APPLE. What are you doing?

  • Does anyone know how i can view PDF files using Galaxy Note 2?

    Does anyone know how i can view PDF files using Galaxy Note 2?
    This is what i have been doing;
    I click on the file i wish to view (via a portal)
    this file goes to notification widget (i drag down screen)
    notification/message says download complete
    i click on notification/message
    nows it says complete action using (here i only have 2 icon options 1= DB Text Editor 2 = HTML Viewer)
    I have installed Adobe Reader.

    Can you confirm if the downloaded file is a pdf file, that is it ends with .pdf?

  • How can i upload file using ajax post request and jsp

    Hi
    this is my code files
    addPhoto.jsp
    <html>
    <head>
    <title>Add Photo</title>
    <script>
    var optionNo = 0;
    var i=1;
    var val=0;
    var file = 0;
    var exten = new Array(".jpg",".jpeg",".gif");
    function addValues()
         for(var i=0;i<5;i++)
              optionNo += 1;
              oNewOption = new Option();
              oNewOption.text = optionNo;
              oNewOption.value = optionNo;
              addSelect.add(oNewOption);
    function addBoxes()
         var str = "";
         var j=0;
         val = document.getElementById('addSelect').value;
         for(j=1; j<= val; j++)
              str = str + '<font size=3>file:' + j + '</font>';
              str = str + '<input type="file" id=filepath'+ j +' name=file'+ j + ' onchange="uploadFile(hidden'+ j + '.value)"><div id="result'+ j +'"></div>
              str = str + '<input type="hidden" name="hidden' + j + '" value=' + j +'>';
         document.getElementById('addPhoto').innerHTML = str;
    function uploadFile(value)
    var str = "filepath" + value;
    file = value;
    var param = document.getElementById(str).value;
    var parameter = "filepath=" + param;
    alert(parameter.length);
    if(checkValidity(param))
    var url = "uploadFile.jsp";
    if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    req.open("POST", url, true);
    req.setRequestHeader("Content-type", "multipart/form-data");
    //req.setRequestHeader("Content-length", parameter.length);
    req.setRequestHeader("Connection", "close");
    req.onreadystatechange = callback;
    req.send(null);
         else
              document.getElementById("result" + file).innerHTML = "upload .jpeg,.jpg,.gif Files Only";
    function callback() {
    if (req.readyState == 4) {
    updatepage(req.responseText);
    function updatepage(str){
         document.getElementById("result" + file).innerHTML = str;
    function checkValidity(str)
         var i=0;
         var j=0;
         var str1 = str.substring(str.lastIndexOf("."),str.length);
         alert(str1);
         for(i=0;i<exten.length;i++)
         if(str1.search(exten) != -1)
              j++;
              break;
         if(j>0)
              return true;
         else
              return false;
    </script>
    </head>
    <body onload="addValues()">
    <h5>Add Photo(s)</h5>
    <select id="addSelect" name="addSelect" onchange="addBoxes()">
    <option id="select" selected>Select</option>
    </select>
    <div id="addPhoto"></div>
    </body>
    </html>
    uploadFile.jsp
    <%@page import="java.io.*"%>
    <%
    /*try
    String contentType = request.getContentType();
         System.out.println(request.getMethod());
         System.out.println("Content type is :: " +contentType); 
         if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0))
              DataInputStream in = new DataInputStream(request.getInputStream());
              DataInputStream in1 = in;
              int formDataLength = request.getContentLength();
    System.out.println(formDataLength);
              byte dataBytes[] = new byte[formDataLength];
              int byteRead = 0;
              int totalBytesRead = 0;
              while (totalBytesRead < formDataLength)
                   byteRead = in1.read(dataBytes, totalBytesRead, formDataLength);
                   totalBytesRead += byteRead;
              out.println("<br>totalBytesRead : " + totalBytesRead + " : formDataLength = " + formDataLength);
         } catch(Exception e) {
              e.printStackTrace();
         try
         String filePath = request.getParameter("filepath");
         System.out.println(filePath);
         File f= new File(filePath);
         String path = f.getName();
         String contentType = request.getContentType();
         System.out.println(contentType);
         //InputStream in = new FileInputStream(filePath);
         DataInputStream in = new DataInputStream(request.getInputStream());
         int formDataLength = request.getContentLength();
         System.out.println(formDataLength);
    byte[] buf = new byte[1024];
    OutputStream out1 = new FileOutputStream("c:/docs/" + path);
    int len;
    while ((len = in.read(buf)) > 0) {
    out1.write(buf, 0, len);
    in.close();
    out1.close();
         out.write("File Uploaded SucssesFully");
    catch(Exception e)
         e.printStackTrace();
         out.write("error while Writing File");
    %>
    the above code in request.getContentType() i am getting 0. I am not passing the content length. for the same application with out using Ajax i am
    getting the size of file... it is very very urgent for me.. pls help me out on this...
    Any one having the code on this pls mail me the code...
    my mail id ... [email protected]
    Regards
    Ashok Kumar

    Sure, you can upload a file, using a form input element of type file. You pick this up with a servlet, though you need a special request wrapper to sort out the multi-part request you get back that way (there's a suitable package on jakarta.apache.org/commons)
    The servlet decrypts the file and can pass the results to a JSP for display.
    Don't try to do the complicated stuff in a JSP, it all gets incredibly messy, and that's not what JSPs are for.

  • HT4864 I have been using AOL for many years as my ISP but now I want to close my account and use iCloud.  My challenge is I don't want to lose five years worth of emails and attachments saved in AOL personal folders.  Can I can transfer the files using iC

    I have been using AOL for many years as my ISP but now I want to close my account and use iCloud.  My challenge is I don't want to lose five years worth of emails and attachments saved in AOL personal folders.  Can I can transfer the files using iCloud?

    Do you receive AOL mail in the Mail app or on the website?

  • Hi, I can not delete files Film / video from the desktop it wants my password I write but Ando I can not float to Trash

    Hi, I can not delete files Film / video from the desktop it wants my password I write but Ando I can not float to Trash

    This topic has a fix for that problem: Desktop to Trash Problem: "Finder wants...: Apple Support Communities
    OT

  • I can't transfer files using bluetooth, i can't transfer files using bluetooth

    i can't transfer files using bluetooth

    Bluetooth on iPads is mainly for use with keyboards and headphones, not for copying content
    Supported Bluetooth profiles : http://support.apple.com/kb/HT3647

  • I can't download files or videos, I get the response "The object is blocked" As far as I know I have removed or disabled all security programs

    I am unable to play streaming video, and can't download anything. I have removed or disabled all of my security programs.
    == This happened ==
    Every time Firefox opened
    == About 2 weeks ago, downloaded most recent Windows service pack

    HI Phillip,
    On the other I am wholly unable to download the file from either Safari or Firefox
    Let's try one browser at a time. Open a Finder window. Select your Home folder in the Sidebar on the left. Then open the Library folder then the Safari folder. Move the Downloads.plist file from the Safari folder to the Trash. Relaunch Safari.
    If that didn't help, from your Safari menu bar click Safari / Reset Safari. Select the top 7 buttons, click Reset.
    Now launch Firefox. From the Firefox menu bar click Firefox / Preferences then select the
    Advanced tab then the Network tab. Click: Clear Now.
    Relaunch Firefox.
    If nothing above has helped either browser, login to your Mac to another user account. Try Safari there. If you can't download files from Safari there, then it's a system wide problem. Boot from your install disc. Run Disk Utility to verify and if necessary, repair any errors on the startup disk.
    Help here for Disk Utility: The Repair functions of Disk Utility: what's it all about?
    Carolyn

  • Can I Stream just the video and Sync everything else?

    Does anyone have any solid solutions for having full access to a 500+ GB iTunes Library on the TV ?
    I have 500 GB of video on an external drive and ~50 GB of music and photos on my internal drive. In other words, my iTunes library is not consolidated and is spread around.
    I want to get a 160 GB TV if I can sync all my music and photos onto the TV and simultaneously configure the video for streaming. If not, it seems I should just get the 40 GB version, since I will have to stream everything anyway and won't need as much space.
    I'm also curious about the ability of TV to access different media files in my iTunes Library if they reside on different hard drives.
    Any first hand accounts or solutions would be much appreciated.
    Thanks

    Hi, thanks for the quick reply ...
    - some have said that external usb drives don't work as well for streaming sometimes on older Macs whereas Firewire will do better
    - NAS drives can be a bit hit and miss depending on the number of steps to transfer data to iTunes then back to AppleTV
    I'm planning to attach my external HD to an AirPort Extreme, which will actually be adjacent to the TV. I suppose I could run an ethernet cable between the Airport Extreme and the TV if it would help.
    - importantly be aware of the limited video playback specs for AppleTV; MP4/h264 only with bitrate limits. If all your video is from iTMS you'll be fine, if not you may have to convert for AppleTV which can be time consuming. Videos that play in iTunes will not necessarily ply on AppleTv without conversion. AppleTV does not support 5.1 sound (you can't stream VOBs for example).
    Almost all of my video has been converted by VisualHub, iSquint or Handbrake to play on my iPod, so I'm hoping I won't need to reconvert anything.

  • How to Save a XML file using Document Object

    Hai all,
    I am new to XML and i created a application to insert a node in the XML file using org.w3c.dom.Document object. And want to know which method has to be used to store the Document object into a XML fille.

    The standard way would be to use a transformer with no transformation where the destination is a StreamResult.
    something like:
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer();
    transformer.transform(new DOMSource(doc), new StreamResult("output.xml"));

  • Can you stream music and video to Samsung blu-ray players?

    Hi
    I'm thinking of buying a Samsung blu-ray player with wireless connectivity. They have the Allshare feature so you can stream music and video content from your desktop to the player. I have read that it does not work with Mac - is that the case? Does anyone have experience of this?
    My wireless modem is one provided to me by O2 not an Airport Extreme
    I was thinking of getting the BD-C6500

    What does this device stream in?

  • Why can I access files using ubuntu live cd but not my mac?

    Hello,
    Every since I have upgraded to Lion then to Mountain Lion I have had nothing but trouble with my mac crashing and not being able to repair the harddrive. I use time machine with an external hard drive to back up everything (also using online server to back up things as well).
    My issue is that disk utility never works ( ever ) and when I have trouble the hard drive and my external hard drive always show up grayed out and disk utility says the disk is broken and cannot be repaired. Which the disk are fine because I can access them using a ubuntu live cd no problem.
    My main question is how is this not being addressed by apple? This is clearly a bug - there is nothing wrong with my external harddrive or my macs hardrive - yet when I restart my mac I fear it will never start again(in its current state) and the disk utility just doesn't work the only answers I ever get is the hard drive is bad (which is not the case being I can access it with the ubuntu - or even reinstall everything and it works fine etc...)
    There is some major bugs and I can say I never had these problems losing my data with a windows machine (though I am not a big windows fan). Apple why doesn't the disk utility work?
    Also why when I update my mac and the mac restarts itself does it not eject my external hardrive - also why if you don't eject the harddrive it ruins the data on the hard drive or at least makes it grayed out or corrupt in my mac - but I can copy the files in ubuntu and put them back then it works just fine? These are serious issues and I am really shocked that the mac community would stand for this kind of thing - I am not the only one with these issues I see thousands of others with the same issues so when are they going to be fixed?
    If what I am saying is unclear - just google mac hardrive cannot be repaired - and set the time for the last month you will see. Also to those who have these troubles simply use a ubuntu live cd - copy all your files to the home folder then place them back to where the reside and mac will reconize them again - worked every time for me so far no thanks to disk utility.

    Your booting off a Ubuntu disk which has it's own operating system on it and on another medium that is free of issues, unlike your current hard drive running OS X 10.8.
    I really don't advise you directly installing Linux on a Mac as it's much more complicated that it appears. Also I don't advise you using Linux anything to tinker with a Mac unless you really really know what your doing.
    Since your Mac's software is broken you don't know currently and shouldn't be using Linux as a band-aid solution to your problem.
    My suggestion is you FIX your primary boot drive.
    disk utility says the disk is broken and cannot be repaired
    This calls for a complete zero erase and install of the affected area, if it's just the Macintosh HD partition then fine, it's a hold command r boot into Recovery HD and use Disk Utiltiy there to Erase with the middle secure erase feature (important) and then a reinstall of OS X 10.8 from Apple's servers over a fast Ethernet connection.
    If your GUID partition table or Recovery HD is affected, then you need to command option r boot into Internet Recovery and select the entire hard drive for the same zero/middle erase proceedure, unless you have a older MacBook Pro then you need to use option key boot off the 10.6 disks and use the Secure Erase/ Zero on the entire drive, install 10.6, then update to 10.6.8, then AppStore upgrade to 10.8 again.
    You need to only restore user files into same named accounts from a Storage Drive backup, do not use Migration or Setup assistant as your TimeMachine drive data is likely corrupted. This means all new softwre installs from original sources as well.
    Read through my many User Tips, you'll be fixing your own machine in no time.
    https://discussions.apple.com/community/notebooks/macbook_pro?view=documents#/?p er_page=50
    also why if you don't eject the harddrive it ruins the data on the hard drive or at least makes it grayed out or corrupt in my mac
    Windows and Linux also has to "safely remove hardware" or "unmount" before ejecting a drive as well or it corrupts the data.
    I guess this feature came about so one can disconnect a drive without having to physically remove it and wear out the ports doing so.

  • HP Pavilion dv3 notebook PC can't burn files using the primary dvd drive.... always hangs in 5%

    my  HP Pavilion dv3 -4103TX notebook PC have a problem in burning any files.. until now it doesn't work. I update the software and still can't burn any files using the built in dvd rom. please help me how to fix it... 

     Try reseating (Remove and reinsert) the DVD drive. You can instructions on page#50 over here
    After this is done,Run Microsoft fixit from below link
    http://go.microsoft.com/?linkid=9740811
    //Click on Kudos and Accept as Solution if my reply was helpful and answered your question//
    I am an HP employee!!

Maybe you are looking for

  • Error when execute avorcldb in agent

    When I try execute the command avorcldb in installation of audit vault agent I recieved the error listed bellow: oracle@bpcatorg01:/u01/app/oracle/OracleHomes/av_agent_1/bin> avorcldb The java class is not found: oracle/av/orcldb/Main In this machine

  • Multiple 'My Links'???

    User is building page with multiple tabs. He would like to use the 'My Links' portlet in several of the tabs. It looks like you can only have one. When he adds the secound 'my links' portlet, it contains all links previously created on another page.

  • Checksum inside EAR Files

    Hello All, Is it possible to recurse an EAR file structure and compute checksums of the files inside the EAR file, say go inside wars, jars etc ? If it can be done then please let me know the Java API to use. TIA

  • AppV 5 and Windows 2012

    Trying to install AppV server on Windows 2012 server.  Getting lots of errors. Is this compatible and/or are there different rules/instructions etc. thanks Dave Dave Kozlowski

  • How can I make my interntet wireless while keeping my desktop connected?

    I just got my Macbook Pro and I love it! One problem... I got airport extreme with it and I don't know how I can keep my PC desktop connected to the internet (no wireless) while having my Macbook wireless? Everyone at the Apple store just said to plu