2 Replies Latest reply on Oct 22, 2010 2:40 PM by nikolos2000

    Loading local file in OSMF with AIR ?

    nikolos2000

      Hello,

       

      I'm trying to use OSMF to make a desktop media player with AIR 2.0. The application receives an XML playlist, parses it, and caches every playlist's item so the application can be run offline later. The cache class is based on the ImageCacheManager Class.

       

      Filepaths are returned as a string like : media.source = 'file:///C:/Users/Nicolas/AppData/Roaming/com.nikolos.butplayer/Local%20Store/cachedresou rces/c0030ec91c31ceb62a271a8d582105ca';

       

      My problem is that the player won't play the cached files... I checked, the cached files are good so I don't understand.

       

      In my code I have : var element:VideoElement = new VideoElement(new URLResource(media.source));

       

      Is this a security issue I'm missing ? I tried with .flv and .jpg in the assets folder of the application and it works just great.

       

      Thanks for your help !

        • 1. Re: Loading local file in OSMF with AIR ?
          rshin Level 3

          This might be just the difference in file handling (url) between air and flex app. Note that OSMF doesn't *officially" support air, but the most of part should work as long as flex supports it.    I'd recommend to try your app in flex first if it works fine, then let us know.  There may be a workaround to handle air specific file handling if that's the case.

           

          Ryan

          1 person found this helpful
          • 2. Re: Loading local file in OSMF with AIR ?
            nikolos2000 Level 1

            Thanks for the advice Ryan.

             

            I just found what the problem was, and it has nothing to do with AIR. The problem was the filename of the local files, which was just a md5 hash WITHOUT the original file extension. Specifying the resource mediatype for each new MediaElement created did the trick.

             

            In case somebody has the same problem :

             

            var resourceCacheFileName:String = 'file:///C:/Users/nikolos2000/AppData/Roaming/com.xxx.butplayer/Local%20Store/cachedresou rces/a212ade577f0fbef8fd3aaa6d5b1a5cd';

             

            var element:VideoElement = new VideoElement(new URLResource(resourceCacheFileName));

             

            element.resource.mediaType = MediaType.VIDEO;

             

            Thanks again,

            Nicolas