| 151 | | Thread.sleep(6000); |
|---|
| 152 | | } |
|---|
| 153 | | |
|---|
| | 151 | } |
|---|
| | 152 | |
|---|
| | 153 | @Test |
|---|
| | 154 | public void mediaListPlayerPause() |
|---|
| | 155 | { |
|---|
| | 156 | libvlc_exception_t exception = new libvlc_exception_t(); |
|---|
| | 157 | LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception); |
|---|
| | 158 | LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception); |
|---|
| | 159 | LibVlcMediaDescriptor mediaDescriptor = libvlc.libvlc_media_descriptor_new(libvlcInstance, mrl, exception); |
|---|
| | 160 | libvlc.libvlc_media_list_add_media_descriptor(mediaList, mediaDescriptor, exception); |
|---|
| | 161 | libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception); |
|---|
| | 162 | libvlc.libvlc_media_list_player_play_item(mediaListPlayer, mediaDescriptor, exception); |
|---|
| | 163 | libvlc.libvlc_media_list_player_pause(mediaListPlayer, exception); |
|---|
| | 164 | Assert.assertEquals(0, exception.raised); |
|---|
| | 165 | int state = libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception); |
|---|
| | 166 | Assert.assertEquals(LibVlcState.libvlc_Paused.ordinal(), state); |
|---|
| | 167 | } |
|---|
| | 168 | |
|---|
| | 169 | @Test |
|---|
| | 170 | public void mediaListPlayerIsPlaying() throws Exception |
|---|
| | 171 | { |
|---|
| | 172 | libvlc_exception_t exception = new libvlc_exception_t(); |
|---|
| | 173 | LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception); |
|---|
| | 174 | LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception); |
|---|
| | 175 | LibVlcMediaDescriptor mediaDescriptor = libvlc.libvlc_media_descriptor_new(libvlcInstance, mrl, exception); |
|---|
| | 176 | libvlc.libvlc_media_list_add_media_descriptor(mediaList, mediaDescriptor, exception); |
|---|
| | 177 | libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception); |
|---|
| | 178 | libvlc.libvlc_media_list_player_play_item(mediaListPlayer, mediaDescriptor, exception); |
|---|
| | 179 | |
|---|
| | 180 | while (true) |
|---|
| | 181 | { |
|---|
| | 182 | int playing = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception); |
|---|
| | 183 | Assert.assertEquals(0, exception.raised); |
|---|
| | 184 | if (playing == 1) |
|---|
| | 185 | { |
|---|
| | 186 | break; |
|---|
| | 187 | } |
|---|
| | 188 | Thread.sleep(150); |
|---|
| | 189 | } |
|---|
| | 190 | Assert.assertEquals(LibVlcState.libvlc_Playing.ordinal(), libvlc.libvlc_media_list_player_get_state( |
|---|
| | 191 | mediaListPlayer, |
|---|
| | 192 | exception)); |
|---|
| | 193 | |
|---|
| | 194 | libvlc.libvlc_media_list_player_stop(mediaListPlayer, exception); |
|---|
| | 195 | while (true) |
|---|
| | 196 | { |
|---|
| | 197 | int playing = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception); |
|---|
| | 198 | Assert.assertEquals(0, exception.raised); |
|---|
| | 199 | if (playing == 0) |
|---|
| | 200 | { |
|---|
| | 201 | break; |
|---|
| | 202 | } |
|---|
| | 203 | Thread.sleep(150); |
|---|
| | 204 | } |
|---|
| | 205 | Assert.assertEquals(LibVlcState.libvlc_Stopped.ordinal(), libvlc.libvlc_media_list_player_get_state( |
|---|
| | 206 | mediaListPlayer, |
|---|
| | 207 | exception)); |
|---|
| | 208 | } |
|---|
| | 209 | |
|---|
| | 218 | |
|---|
| | 219 | @Test |
|---|
| | 220 | public void mediaListPlayerSetMediaInstance() |
|---|
| | 221 | { |
|---|
| | 222 | libvlc_exception_t exception = new libvlc_exception_t(); |
|---|
| | 223 | LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception); |
|---|
| | 224 | LibVlcMediaDescriptor md = libvlc.libvlc_media_descriptor_new(libvlcInstance, mrl, exception); |
|---|
| | 225 | LibVlcMediaInstance mi = libvlc.libvlc_media_instance_new_from_media_descriptor(md, exception); |
|---|
| | 226 | libvlc.libvlc_media_list_player_set_media_instance(mediaListPlayer, mi, exception); |
|---|
| | 227 | Assert.assertEquals(0, exception.raised); |
|---|
| | 228 | } |
|---|