Changeset 699dd7887738f8e1373a4cf3d8c03f010c70a29b

Show
Ignore:
Timestamp:
03/21/08 15:21:52 (4 months ago)
Author:
Filippo Carone <littlejohn@videolan.org>
git-committer:
Filippo Carone <littlejohn@videolan.org> 1206109312 +0100
git-parent:

[f56d550753a30c5bae8e44fef87b8986cc309ac2]

git-author:
Filippo Carone <littlejohn@videolan.org> 1206109312 +0100
Message:

give the opportunity to play synchronously

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bindings/java/core/src/main/java/org/videolan/jvlc/MediaListPlayer.java

    ra19cac2 r699dd78  
    6060        libvlc_exception_t exception = new libvlc_exception_t(); 
    6161        jvlc.getLibvlc().libvlc_media_list_player_play(instance, exception); 
     62        try 
     63        { 
     64            while (jvlc.getLibvlc().libvlc_media_list_player_is_playing(instance, exception) == 0) 
     65            { 
     66                Thread.sleep(25); 
     67            } 
     68        } 
     69        catch(InterruptedException e) 
     70        { 
     71            // 
     72        } 
    6273    } 
    6374 
     
    7485    } 
    7586 
     87    /** 
     88     * Plays the given descriptor and returns only when the player has started to play. 
     89     * @param descriptor The media descriptor to play 
     90     */ 
     91    public void playItem(MediaDescriptor descriptor) 
     92    { 
     93        playItem(descriptor, true); 
     94    } 
    7695     
    77     public void playItem(MediaDescriptor descriptor) 
     96    /** 
     97     * @param descriptor The media descriptor to play 
     98     * @param synchronous If true it does not return until the player is not playing. 
     99     */ 
     100    public void playItem(MediaDescriptor descriptor, boolean synchronous) 
    78101    { 
    79102        libvlc_exception_t exception = new libvlc_exception_t(); 
    80103        jvlc.getLibvlc().libvlc_media_list_player_play_item(instance, descriptor.getInstance(), exception); 
     104        if (!synchronous) 
     105        { 
     106            return; 
     107        } 
     108         
     109        try 
     110        { 
     111            while (jvlc.getLibvlc().libvlc_media_list_player_is_playing(instance, exception) == 0) 
     112            { 
     113                Thread.sleep(25); 
     114            } 
     115        } 
     116        catch(InterruptedException e) 
     117        { 
     118            // 
     119        } 
     120         
    81121    } 
    82122 
     123    /** 
     124     * Plays the item at the given index and returns only when the player has started to play. 
     125     * @param index The item index to play. 
     126     */ 
    83127    public void playItem(int index) 
     128    { 
     129        playItem(index, true); 
     130    } 
     131     
     132    /** 
     133     * @param index The item index to play. 
     134     * @param synchronous If true it does not return until the player is not playing. 
     135     */ 
     136    public void playItem(int index, boolean synchronous) 
    84137    { 
    85138        libvlc_exception_t exception = new libvlc_exception_t(); 
    86139        jvlc.getLibvlc().libvlc_media_list_player_play_item_at_index(instance, index, exception); 
     140        try 
     141        { 
     142            while (jvlc.getLibvlc().libvlc_media_list_player_is_playing(instance, exception) == 0) 
     143            { 
     144                Thread.sleep(25); 
     145            } 
     146        } 
     147        catch(InterruptedException e) 
     148        { 
     149            // 
     150        } 
    87151    } 
    88152