@Before public void setupMediaElements() throws InterruptedException { AsyncResultManager<PlayerEndpoint> async = new AsyncResultManager<>("PlayerEndpoint creation"); new PlayerEndpoint.Builder(pipeline, URL_SMALL).buildAsync(async.getContinuation()); player = async.waitForResult(); Assert.assertNotNull(player); }
@Test public void testGetUri() throws InterruptedException { AsyncResultManager<String> async = new AsyncResultManager<>("player.getUri() invocation"); player.getUri(async.getContinuation()); String uri = async.waitForResult(); Assert.assertEquals(URL_SMALL, uri); }
@Test public void testEventEndOfStream() throws InterruptedException { AsyncResultManager<ListenerSubscription> asyncListener = new AsyncResultManager<>("EndOfStream Listener registration"); AsyncEventManager<EndOfStreamEvent> asyncEvent = new AsyncEventManager<>("EndOfStream event"); player.addEndOfStreamListener( asyncEvent.getMediaEventListener(), asyncListener.getContinuation()); asyncListener.waitForResult(); player.play(); asyncEvent.waitForResult(); }
/** * start/pause/stop sequence test * * @throws InterruptedException */ @Test public void testPlayer() throws InterruptedException { AsyncResultManager<Void> async = new AsyncResultManager<>("player.play() invocation"); player.play(async.getContinuation()); async.waitForResult(); AsyncResultManager<Void> async2 = new AsyncResultManager<>("player.pause() invocation"); player.pause(async2.getContinuation()); async2.waitForResult(); AsyncResultManager<Void> async3 = new AsyncResultManager<>("player.stop() invocation"); player.stop(async3.getContinuation()); async3.waitForResult(); }