7 Replies Latest reply on Sep 28, 2012 2:42 AM by Gaius Coffey

    Google IMA integration with OSMF?

    steveperr124 Level 1

      Hi there

       

      Just wondering if anyone has had any experience integrating the Google IMA library into an OSMF, am struggling for ideas as to the best possible method.

       

      http://code.google.com/apis/ima/docs/sdks/googleflashas3_apis.html#AdsManager

       

      The integration requires a Video Class Object to be passed to it in order to playback a video ad, and record the impressions correctly.

       

      As the ads are intended to be pre-rolls, I am trying to use the same Video screen of my OSMF player - but i cant get access to it from the OSMF api !

      I am trying to prevent having to create a separate video class screen object just to play ads and add/remove it when necessary.

       

      Any suggestions welcomed!

       

      Thanks


      Steve

        • 1. Re: Google IMA integration with OSMF?
          Gaius Coffey Level 2

          Hi,

          Curious whether you resolved this one as I am in a similar position?

          I went with a VAST solution (OSMF's VAST classes) as an interim, but now customer is looking for Google API only functions that are outside of the VAST model so may have to concoct a custom display class as an IMediaElement. Very interested to here of your progress on this...

          • 2. Re: Google IMA integration with OSMF?
            steveperr124 Level 1

            Hi there

             

            Unfortunately i didnt come across another solution for this in time, apart from what I mentioned before which is a bit messy, but the only way I could get it to work. I too was looking down the VAST route using those classes, which in theory should work fine so I think with maybe a little customisation of those classes it should work. I have not re-visited this recently but will be sure to post when I do if i find anything

             

            Thanks

             

            Steve

            • 3. Re: Google IMA integration with OSMF?
              TheRossman

              I tried the VAST/VPAID classes that come with OSMF but they do not seem to work reliably.

               

              I have found using the IMA SDK to be the best way to go, just pause your main content, create another video object and z-index over your main content for the ads...then hide it all and resume playback when ads are complete.  New (v3) IMA SDK looks to be somewhat different but still does not support OSMF directly it seems.

              • 4. Re: Google IMA integration with OSMF?
                Gaius Coffey Level 2

                Hi TheRossman,

                I found it was actually quite straightforward to implement an OSMF MediaElement that integrated directly with the OSMF system by implementing custom traits that interact directly with Google IMA.

                 

                All well and good, but now I have to implement adverts for mobile as an AIR app where I can't use IMA because of its reliance on access to blocked objects and methods like Security. (Seriously, cannot even _instantiate_ IMA for mobile as the blocked calls occur in the class instantiation function.)

                 

                G

                • 5. Re: Google IMA integration with OSMF?
                  TheRossman Level 1

                  Hi Gaius,

                   

                  I think you must be better at OSMF than me    I still feel as though I am stumbling around a bit in here, creating such an integrated approach sounds pretty awesome but sadly seems I'm not quite there yet in terms of skill!

                   

                  Good to know it can be done though!  Maybe I will give it another go when integrating the new IMA3 SDK, which seems to work quite a bit differently (you just tell it where the playhead is and it handles ad insertion).

                   

                  Thanks for the feedback & good luck with your mobile endeavour!

                  • 6. Re: Google IMA integration with OSMF?
                    steveperr124 Level 1

                    Any chance of a sneek peek at those custom traits you mention Gaius ;-) Would be good to understand the approach you took

                     

                    Thanks

                     

                    Steve

                    • 7. Re: Google IMA integration with OSMF?
                      Gaius Coffey Level 2

                      Hi Steve,

                      Obviously can't post the whole thing as it is proprietary code for a customer, but here is a snippet; this is the play trait:

                      [code]

                      package XXXX {
                      import flash.net.NetStream;

                      import org.osmf.traits.PlayState;
                      import org.osmf.traits.PlayTrait;

                      public class GoogleIMAPlayTrait extends PlayTrait
                      {
                      public function GoogleIMAPlayTrait(ns:NetStream=null)
                      {
                        super();
                        netStream = ns;
                      }
                      public function get netStream():NetStream {
                        return _netStream;
                      }
                      public function set netStream(ns:NetStream):void {
                        _netStream = ns;
                      //   this.setCanPause(_netStream!=null);
                      }
                      private var _netStream:NetStream;

                      /**
                        * Called immediately before the <code>playState</code> property value is changed.
                        * <p>Subclasses can override this method to communicate the change to the media.</p>
                        * 
                        *  @langversion 3.0
                        *  @playerversion Flash 10
                        *  @playerversion AIR 1.5
                        *  @productversion OSMF 1.0
                        */
                      override protected function playStateChangeStart(newPlayState:String):void
                      {
                        if(netStream) {
                         switch(newPlayState) {
                          case PlayState.PAUSED :
                           netStream.pause();
                           break;
                          case PlayState.STOPPED :
                           break;
                          case PlayState.PLAYING :
                           // Assume that netStream from ad has already had play start
                           // so that this is just an "unpause" command
                           netStream.resume();
                           break;
                         }
                        }
                      }
                      private var paused:Boolean = false;
                      }
                      }

                      [/code] 

                      Process was quite straightforward, though, this is what I did / do:

                       

                      1. Extended LoaderBase to build a GoogleIMALoader class

                      2. Extend LoadableElementBase to build a GoogleIMAMediaElement class

                      3. Implement custom traits for all the things I need to control as per the above

                      4. Create a MediaFactoryItem that will recognise my advert resources to map them

                      5. Register the MediaFactoryItem with the DefaultMediaFactory

                       

                      That way, I can send advert URLs to my MediaFactory in the same way as for any other media and they will seamlessly blend into the OSMF player.

                      G