Results 1 to 6 of 6

Thread: FlashComponent Implementation For Media Play - Need Suggestion

  1. #1
    Ext GWT Premium Member
    Join Date
    Oct 2010
    Posts
    193

    Exclamation FlashComponent Implementation For Media Play - Need Suggestion

    We are using a flash player added to our application header( which is basically a toolbar).
    Created a wrapper class which takes in the required flash player and files to be played dynamically

    Example code as seen below,
    Code:
          SwfConfig config = new SwfConfig();
          config.addParameter("allowfullscreen", "false");
          config.addParameter("allowscriptaccess", "always");
          config.addFlashVar("autostart", "false");
          config.addFlashVar("repeat", "true");
          config.addFlashVar("id", "appHeaderPlayer");
          config.addFlashVar("file", "dummy.mp3");
    
         AppFlashComponent  flashComp = new AppFlashComponent("player.swf", config);
         flashComp.setSize(300, 23);
    **Here, AppFlashComponent is subclass of FlashComponent which overrides the onAttach() method and injects the 'config'.

    Then, added this flash component to the header.

    Now the requirement is to perform operation on the Media Player - for example Add, Removed, Update for Playable media files/PlayLists, Play, Pause, Stop etc basic operation controls -

    Need help to understand:
    [A] How to have control on the flash player via FlashComponent, so that it can be interacted programatically, say with external events( Add, Removed, Update for Playable media files/PlayLists, Play, Pause, Stop etc), the Player can be controlledworks the player should start playing
    [B] Secondly, If we add the playlist to the player, and later try to remove a track from the playlist, how will we come to know if that particular track is already playing or not.

    Kindly suggest the method flow or approach that we need to follow to have this functionality in place.

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    I think it make more sense to move this thread to the normal help forum as this is no longer really gxt related. In the open forums everybody could reply. Should i move this thread?

    Also think about this. You are asking for help to control third party software (here, player.swf) without telling anyone what software this is exactly.

  3. #3
    Ext GWT Premium Member
    Join Date
    Oct 2010
    Posts
    193

    Default

    Thanks Sven!!

    I want the ways to communicate to any particular swf. My goal is how to communicate with swf by means of the exposed methods. Suppose the swf file can respond to method invokes file_play(file_id:int,file_path:String), file_playAll(file_id:int,[file_path:String,file_path:String,...]) etc.
    I want your help to get the API methods of FlashComponent which will help me to allow to invoke these methods of the swf file.
    If you can suggest on FlashComponent handling then it would be great help else you can move this thread to appropriate forum.

  4. #4
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    I moved this thread to the normal help forum so everybody can reply. Basicly this is possible as long the the flash movie exports these APIs to javascript. However this is not really linked to FlashComponent, nor GXT in general.

  5. #5
    Ext GWT Premium Member
    Join Date
    Oct 2010
    Posts
    193

    Default

    All !!!
    Here is the summary the steps what I am following and need your suggestion for guidance:
    1. Using FlashComponent adding my swf(miniPlayer.swf) to my application.
    Important to update that 'miniPlayer.swf' can cater to method invokes such as file_play(file_id:int,file_path:String), file_playAll(file_id:int,[file_path:String,file_path:String,...]) etc.
    2. Using SwfConfig object can inject config to play file through the FlashComponent.

    Now the issue is:
    Once the FlashComponent is added, how to communicate with the 'miniPlayer.swf' and work with the different methods exposed by 'miniPlayer.swf'.

    Whether FlashComponent provides any help to identify the method exposed by the swf files, or I need to write some wrapper JavaScript file to communicate to the swf file and then need to come up with JavaScriptObject file to talk with the JavaScript file.

    Thanks in advance.

  6. #6
    Ext GWT Premium Member
    Join Date
    Oct 2010
    Posts
    193

    Default

    Hi,
    With above approach, I could add the flash component to html.

    Now the issue is how to communicate with the swf to use its functions.
    For example: 'player.swf' exposes function fl_play() with input parameter String filePath.

    I added one JS file 'MySwfCommunicator' with function 'playFlash(String filePath, String swfId)'
    Code:
    MySwfCommunicator.prototype = {
        playFlash: function(trackString,  swfId) {        
              var swfComp = document.getElementById(swfId);
              if (swfComp != null)
                   swfComp.fl_play(trackString);     
     }
    With above code, I could get the swfComp, but I am unable to invoke 'fl_play()' as JavaScript error is thrown as:
    swfComp.fl_play() not a function.

    Please help.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •