22 Replies Latest reply on May 4, 2012 1:21 PM by drkstr_1

    Flex 4.5.1, iOS and videos

    Vincent Nabet

      It is possible to play rtmp (or http dynamic streaming) on an iOS flex application ?

       

      thanks

        • 1. Re: Flex 4.5.1, iOS and videos
          PresidentCamacho

          *bump*

           

          This is an extremely important question.  I really hope so, but I do not see VideoPlayer listed under the supported mobile controls here:

           

          http://www.adobe.com/devnet/flex/articles/mobile-development-flex-flashbuilder.html

           

          Also, without any way to access the native API for iOS, it would seem we are plain out of luck for Flex video support, which seems amazingly silly.

           

          [edit] I did find Rich Media Advertising on the Labs site, specifically targetted for mobile phones, and one of the features specified full screen video.  No idea how old or young the project, and there's no code or anything useful

           

          http://labs.adobe.com/technologies/rmadvertising/

          • 2. Re: Flex 4.5.1, iOS and videos
            drkstr_1 Level 4

            Yes, it is.

             

            VideoPlayer != video support...

             

            The VideoPlayer is just a spark component that "wraps" a VideoDisplay with some added skinning options and button controls to control the playback. Since the default skin is not optomized for mobile, it is not recommended for such use.

             

            You can still implement your own solution using the native video support in Flash, using the higher level VideoDisplay class in Flex, or creating a mobile optimized skin for the VideoPlayer itself. I

             

            However, I have heard reports that live video streaming can have some preformance issues if your media encoding is not optimized for the device it's being run on, but I think AIR 2.7 has ironed out some of the issues with that. I cannot confirm this since I didnt notice any issues to begin with in AIR 2.6.

            • 3. Re: Flex 4.5.1, iOS and videos
              Vincent Nabet Level 1

              If you have an example of code that runs on iOS ?
              I tested a rtmp stream and a http
              dynamic streaming, with

              OSMF, but it does not work on IOS.
              However it works correctly on Android

              • 4. Re: Flex 4.5.1, iOS and videos
                drkstr_1 Level 4

                I'll take a look and see what we are using in our iOS app when I get to the office. I must admit I didn't work on that part of the app myself, I just designed the overall architecture. We do have video running in our prototype though, so I know it's possible one way or another...

                • 5. Re: Flex 4.5.1, iOS and videos
                  Vincent Nabet Level 1

                  Thank you, I'm really interested !

                  • 6. Re: Flex 4.5.1, iOS and videos
                    drkstr_1 Level 4

                    Well I feel foolish now.

                     

                    It looks like our prototype has the video embeded for our iOS build.

                     

                    After some looking around, it does seem possible to use use StageWebView (or more specifically StageWebViewBridge) to position a chromeless native browser window over the video display, and use the native video support in HTML5.

                     

                    http://sonnati.wordpress.com/2011/04/26/air-2-6-for-ios-and-video-playback/

                     

                    Since embeding the video is not an acceptable solution for our project, I will have do some experimentation on my iPad using the above method, and post back when I have a working solution.

                    • 7. Re: Flex 4.5.1, iOS and videos
                      PresidentCamacho Level 1

                      FWIW, I was entirely unable to get any video working either through VideoDisplay nor through setting up my own custom MediaPlayer with a VideoElement.  It's possible I screwed something up, but I implemented exactly what the API examples had.  The StageWebView trick did not work for me either.

                       

                      For now it looks like I'll be punting - using navigateToURL() to open a Safari window, that plays videos fine.

                      • 8. Re: Flex 4.5.1, iOS and videos
                        David Zephaniah

                        Did you figure this out?

                        Do you have a sample on this?

                         

                        I really wanna try to display streaming video from a FMS 3.5 on iPhone/iPad devices.

                         

                         

                        Thanks in advance,

                         

                        David

                        • 9. Re: Flex 4.5.1, iOS and videos
                          JeffPei

                          I am trying this too for video chatting with FMS 4.0. This is a critically important feature.

                          • 10. Re: Flex 4.5.1, iOS and videos
                            drkstr_1 Level 4

                            I finally got around to testing this.

                             

                            FLV streaming over rtmp works just fine. I have not tested other codecs yet, but I just wanted to toss this out there in case anyone was wondering if it was even possible. It is.

                             

                            I am using AIR 2.7 and the Flex 4.5.1 Framework.

                             

                            Cheers!

                            • 11. Re: Flex 4.5.1, iOS and videos
                              jeffpeiyt

                              Hi drkstr,

                               

                              Awesome! We really need your help on this: NetConnection is OK but NetStream object initialization raised exception.

                               

                              We are using FMS 4.0

                               

                              We have made the Flex based video chat working inside of browsers as SWF using both RTMFP/RTMP.

                              private var connectUrl:String = "rtmfp://1.2.3.4:80/app";

                               

                              But the same code; after modifications to compile as a mobile project, the "NetConnection" is ok: in server admin we can see the new connection; and we obtained the nearID;

                               

                              but the exception is always raised: NetStream is always failed;  "incomingStream=new NetStream(netConnection);" THIS LINE.

                               

                              Then, I changed to incomingStream=new NetStream(netConnection, netConnection.nearID); the error message disappear; but I still cannot get either the iphone's videoCam sending outgoing streams; or get the incoming streams for this.

                               

                              According to some weird Chinese source code I found online: http://www.3amartstudio.com/blog/post/125.html

                               

                               

                               

                              Code:

                               

                              var msg:Boolean;

                              msg=e.info.code == "NetConnection.Connect.Success";

                              if (msg)

                              {

                              status("Connected, my ID: " + netConnection.nearID + "\n");

                              // nsOut=new NetStream(nc);

                              incomingStream=new NetStream(netConnection, netConnection.nearID);   // now I changed to this; with the parameter.... this line used to raise an exception

                              outgoingStream=new NetStream(netConnection);

                               

                              ....

                              • 12. Re: Flex 4.5.1, iOS and videos
                                drkstr_1 Level 4

                                I am using a spark VideoDisplay with a DynamicStreamingVideoSource.

                                 

                                This code works as expected when deployed to the iPad.

                                 

                                 

                                <?xml version="1.0" encoding="utf-8"?>
                                <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
                                     <s:Panel top="0" left="0" bottom="0" right="0" title="Video Stream Test">
                                          <s:VideoDisplay horizontalCenter="0" verticalCenter="0">
                                               <s:source>
                                                    <s:DynamicStreamingVideoSource host="rtmp://www.domain.com/StreamAppName">
                                                         <s:DynamicStreamingVideoItem streamName="video_name" />
                                                    </s:DynamicStreamingVideoSource>
                                               </s:source>
                                          </s:VideoDisplay>
                                     </s:Panel>
                                </s:Application>
                                

                                 

                                 

                                The VideoDisplay is basically just a wrapper for OSMF, so if you are not using Flex, you can easily (relativly) copy out the code and create your own solution using just OSMF. This code was tested against FMS 3 (not sure the specific version). I'm not sure exactly why the NetStream method you're using isn't working, but it would appear that OSMF has it handled.

                                 

                                Also, I'm not sure if it matters but I am using the AIR 2.7 SDK (as apposed AIR 2.6, which shipped with Flash Builder 4.5).

                                 

                                 

                                Cheers!

                                • 13. Re: Flex 4.5.1, iOS and videos
                                  JeffPei Level 1

                                  Looks awesome!

                                   

                                  I am currently using AIR 2.6 and hopefully that is the reason.

                                   

                                  Do we still need to use the netstreams? we still need to handle some events with some AS3 as a chatting (two way) video application rather than simply 1-way streaming.

                                   

                                  But looks promising. I will let you know whether we success on this. :-)

                                  • 14. Re: Flex 4.5.1, iOS and videos
                                    jeffpeiyt Level 1

                                    We verified your code. Work with RTMP in the iPhone Simulator. When changed to RTMFP it cannot receive. Hopefully you may get RTMFP work in next AIR update. (We experienced much less latency in UDP based RTMFP in live video chat. )

                                     

                                    Has some trouble install the ipa file. (updated to AIR 2.7 according to http://www.newyyz.com/ntgsite/blog/?p=1303)

                                     

                                    We experience the "unable to download" issue when the installation is almost done 95% on a itouch 4thGen.

                                     

                                    Similar to this:http://devgirl.org/2011/06/20/flexair-for-ios-development-process-explained/#jargon

                                     

                                    Joseph Abenhaim says:

                                    Hi Holly,

                                    Great Info! I have a problem however, I followed your intructions and added 5 devices (all iphone 4s running 4.2+) 3 of those devices work great, I created a distribution portal and everything works great to download the app on those devices, however 2 of those devices fail, saying unable to download always at around 90% of the installation process. I did some digging around and aparently thats either due to the device id’s not added in the provisioning profile or a boolean flag set in the Entitlements.plist package. The former has been verified and all 5 devices are actually in the package. I even unpacked the ipa to verify the right provisioning profile contained all the correct ID’s for the phone.

                                    As far as the Entitlements.plist, is that even possible to have or add on a flash builder project ?

                                    Thanks!

                                     

                                     

                                    Do you have some code to access the local cam from iphone? the current code failed to get the ipod's cam displayed...

                                    • 15. The only part missing: iTouch cannot publish netstream Re: Flex 4.5.1, iOS and videos
                                      JeffPei Level 1

                                      Updated:

                                       

                                      we are able to open and see the local cam video from the itouch; we are able to see the remote video in itouch from the remote desktop;

                                       

                                      we only not able to send the netstream (publish) from the itouch.

                                       

                                      in simulator it is the same: the admin in FMS 4 cannot get the stream: no found the published video from the itouch end..

                                       

                                       

                                      any idea?

                                      • 16. Re: The only part missing: iTouch cannot publish netstream Re: Flex 4.5.1, iOS and videos
                                        jeffpeiyt Level 1

                                        Updated. We got 2-way real-time video/audio works on iOS

                                        only works for RTMP but not works for RTMFP.

                                        • 17. Re: The only part missing: iTouch cannot publish netstream Re: Flex 4.5.1, iOS and videos
                                          Zayd Junglee

                                          Hey Jeffpeiyt

                                           

                                          I've been scouring the internet for some ideas of how to integrate an FMS solution with iOS - they are quite rare and it seems like a relatively new topic that is being discussed - this forum thread being one of them!

                                           

                                          It seems you have been working on a project that is something I'm looking to investigate into as well - it is actually based around a PhD I'm doing.

                                           

                                          Would it be possible to exchange emails and for me to ask some questions about your findings?

                                           

                                          Thanks in advanced

                                           

                                          Zayd.

                                          • 18. Re: Flex 4.5.1, iOS and videos
                                            mashghasem

                                            Dear drkstr_1

                                             

                                            I used your code in Flash Builder 4.6 with FMS 4.5 but it is only work on iPad simulator, i checked both RTMP and HTTP protocol but nothing happen

                                            My video format are f4v,flv,mp4

                                            this is the code i used:

                                             

                                            <s:VideoDisplay
                                                   
                                            width="500" height="300">
                                                   
                                            <s:source>
                                                       
                                            <s:DynamicStreamingVideoSource
                                                           
                                            host="rtmp://serverID/vod/">
                                                           
                                            <s:DynamicStreamingVideoItem
                                                               
                                            streamName="MP4:sample1_150.f4v"
                                                               
                                            bitrate="150" />
                                                           
                                            <s:DynamicStreamingVideoItem
                                                               
                                            streamName="MP4:sample2_500.f4v"
                                                               
                                            bitrate="500" />
                                                           
                                            <s:DynamicStreamingVideoItem
                                                               
                                            streamName="sample3_1000.f4v"
                                                               
                                            bitrate="1000" />
                                                       
                                            </s:DynamicStreamingVideoSource>
                                                   
                                            </s:source>
                                            </s:VideoDisplay >

                                            • 19. Re: Flex 4.5.1, iOS and videos
                                              drkstr_1 Level 4

                                              I am using basic flv (On2 VP6, MP3, 128 kbps, Stereo) streaming from FMS with no problem. I have heard that H264 mpeg *should* work, but I can't confirm this first hand.

                                               

                                              Also, I should mention that I have had issues clearing out a DynamicStreamingVideoSource from memory. It is very sesantive to memory leaks unless you do it just right.

                                               

                                              See: https://bugs.adobe.com/jira/browse/SDK-31025

                                               

                                              And: http://forums.adobe.com/message/3928561

                                               

                                              It is not so much of an issue if you are not constantly swapping out views with videos on them.

                                               

                                               

                                              I have not had the same issues mentioned above while using a basic string source, IE: "rtmp://host/video". Although this doesn't help much if you actually need dynamic bitrate detection.

                                               

                                               

                                              Cheers and good luck!

                                              • 20. Re: Flex 4.5.1, iOS and videos
                                                thisismyquestion

                                                Hi, i am publishing my live video stream from flex application like this

                                                 

                                                ns_out.publish("livestream", "live");

                                                 

                                                and receiving it from flex mobile (IOS) application

                                                 

                                                ns_in.receiveVideo(true);

                                                ns_in.play("liveStream");

                                                 

                                                but i am not receiving yet anything on my simulator, but in mean while when i publish my video from flash media live encoder, my flex ios application runs it smoothy..:)

                                                 

                                                I  am using Adobe Flash Builder for this development..

                                                 

                                                Any help is appreciated!

                                                Thanks

                                                • 21. Re: Flex 4.5.1, iOS and videos
                                                  MrCodeghost

                                                  Has anyone submitted an app using the VideoDisplay to the AppStore?

                                                  It works fine for me, but it seems as though it would be in breach of AppStore rules regarding video content having to be HTTPStreaming?

                                                  • 22. Re: Flex 4.5.1, iOS and videos
                                                    drkstr_1 Level 4

                                                    Yes, we have an app in production (iOS Volume Purchasing Program) that utilizes flash video.

                                                     

                                                    Also, progressive download is not completely restricted. Per the iOS program guidelines:

                                                     

                                                    If your app delivers video over cellular networks, and the video exceeds either 10 minutes duration or 5 MB of

                                                    data in a five minute period, you are required to use HTTP Live Streaming. (Progressive download may be used

                                                    for smaller clips.)

                                                     

                                                    We used RTMP in lieu of HTTP Live Streaming, and have had no complaints from Apple. I believe they are more concerned with the "streaming experience" rather than the actual delivery protocol. This is just anecdotal information however, and you may want to call up iOS developer support to confirm it (just don't rat me out if they say no! hehe).