Changeset 699dd7887738f8e1373a4cf3d8c03f010c70a29b
- 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
| ra19cac2 |
r699dd78 |
|
| 60 | 60 | libvlc_exception_t exception = new libvlc_exception_t(); |
|---|
| 61 | 61 | 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 | } |
|---|
| 62 | 73 | } |
|---|
| 63 | 74 | |
|---|
| … | … | |
| 74 | 85 | } |
|---|
| 75 | 86 | |
|---|
| | 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 | } |
|---|
| 76 | 95 | |
|---|
| 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) |
|---|
| 78 | 101 | { |
|---|
| 79 | 102 | libvlc_exception_t exception = new libvlc_exception_t(); |
|---|
| 80 | 103 | 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 | |
|---|
| 81 | 121 | } |
|---|
| 82 | 122 | |
|---|
| | 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 | */ |
|---|
| 83 | 127 | 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) |
|---|
| 84 | 137 | { |
|---|
| 85 | 138 | libvlc_exception_t exception = new libvlc_exception_t(); |
|---|
| 86 | 139 | 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 | } |
|---|
| 87 | 151 | } |
|---|
| 88 | 152 | |
|---|