@Test public void testAddClip() throws Exception { TrackImpl videoTrack = new TrackImpl(); videoTrack.setIdentifier("track-1"); videoTrack.setFlavor(new MediaPackageElementFlavor("source", "presentation")); videoTrack.setURI(new URI("http: videoTrack.addStream(new VideoStreamImpl()); videoTrack.setDuration(1000000000000L); SmilResponse smilResponse = smilService.createNewSmil(); smilResponse = smilService.addParallel(smilResponse.getSmil()); SmilMediaContainer par = (SmilMediaContainer) smilResponse.getEntity(); smilResponse = smilService.addClip(smilResponse.getSmil(), par.getId(), videoTrack, 1000L, 1000000L); SmilMediaObject media = null; for (SmilObject entity : smilResponse.getEntities()) { if (entity instanceof SmilMediaObject) { media = (SmilMediaObject) entity; break; } } assertNotNull(media); assertEquals(media.getId(), ((SmilMediaContainer) smilResponse.getSmil().getBody().getMediaElements().get(0)) .getElements().get(0).getId()); assertTrue(media instanceof SmilMediaVideoImpl); assertSame(((SmilMediaElement) media).getMediaType(), SmilMediaElement.MediaType.VIDEO); assertEquals(1000L, ((SmilMediaElement) media).getClipBeginMS()); assertEquals(1001000L, ((SmilMediaElement) media).getClipEndMS()); TrackImpl audioTrack = new TrackImpl(); audioTrack.setIdentifier("track-2"); audioTrack.setFlavor(new MediaPackageElementFlavor("source", "presenter")); audioTrack.setURI(new URI("http: audioTrack.addStream(new AudioStreamImpl()); audioTrack.setDuration(1000000000000L); smilResponse = smilService.addClip(smilResponse.getSmil(), par.getId(), audioTrack, 1000L, 1000000L); media = null; for (SmilObject entity : smilResponse.getEntities()) { if (entity instanceof SmilMediaObject) { media = (SmilMediaObject) entity; break; } } assertNotNull(media); assertEquals(media.getId(), ((SmilMediaContainer) smilResponse.getSmil().getBody().getMediaElements().get(0)).getElements().get(1).getId()); assertTrue(media instanceof SmilMediaAudioImpl); assertSame(((SmilMediaElement) media).getMediaType(), SmilMediaElement.MediaType.AUDIO); assertEquals(1000L, ((SmilMediaElement) media).getClipBeginMS()); assertEquals(1001000L, ((SmilMediaElement) media).getClipEndMS()); smilResponse = smilService.addParallel(smilResponse.getSmil()); par = (SmilMediaContainer) smilResponse.getEntity(); smilResponse = smilService.addClips(smilResponse.getSmil(), par.getId(), new Track[]{audioTrack, videoTrack}, 15000L, 1000L); assertSame(2, smilResponse.getEntitiesCount()); assertTrue(smilResponse.getEntities()[0] instanceof SmilMediaElement); SmilMediaElement mediaElement = (SmilMediaElement) smilResponse.getEntities()[0]; assertTrue(mediaElement.getMediaType() == SmilMediaElement.MediaType.AUDIO); assertEquals(15000L, mediaElement.getClipBeginMS()); assertEquals(16000L, mediaElement.getClipEndMS()); mediaElement = (SmilMediaElement) smilResponse.getEntities()[1]; assertTrue(mediaElement.getMediaType() == SmilMediaElement.MediaType.VIDEO); assertEquals(15000L, mediaElement.getClipBeginMS()); assertEquals(16000L, mediaElement.getClipEndMS()); }
@Override public SmilResponse addClip(Smil smil, String parentId, Track track, long start, long duration) throws SmilException { return addClip(smil, parentId, track, start, duration, null); }
SmilServiceImpl implements SmilService { @Override public SmilResponse addClip(Smil smil, String parentId, Track track, long start, long duration) throws SmilException { return addClip(smil, parentId, track, start, duration, null); } }
SmilServiceImpl implements SmilService { @Override public SmilResponse addClip(Smil smil, String parentId, Track track, long start, long duration) throws SmilException { return addClip(smil, parentId, track, start, duration, null); }  }
SmilServiceImpl implements SmilService { @Override public SmilResponse addClip(Smil smil, String parentId, Track track, long start, long duration) throws SmilException { return addClip(smil, parentId, track, start, duration, null); }  @Override SmilResponse createNewSmil(); @Override SmilResponse createNewSmil(MediaPackage mediaPackage); @Override SmilResponse addParallel(Smil smil); @Override SmilResponse addParallel(Smil smil, String parentId); @Override SmilResponse addSequence(Smil smil); @Override SmilResponse addSequence(Smil smil, String parentId); @Override SmilResponse addClip(Smil smil, String parentId, Track track, long start, long duration); @Override SmilResponse addClip(Smil smil, String parentId, Track track, long start, long duration, String pgId); @Override SmilResponse addClips(Smil smil, String parentId, Track[] tracks, long start, long duration); @Override SmilResponse addMeta(Smil smil, String name, String content); @Override SmilResponse removeSmilElement(Smil smil, String elementId); @Override SmilResponse fromXml(String smilXml); @Override SmilResponse fromXml(File smilXmlFile); }
SmilServiceImpl implements SmilService { @Override public SmilResponse addClip(Smil smil, String parentId, Track track, long start, long duration) throws SmilException { return addClip(smil, parentId, track, start, duration, null); }  @Override SmilResponse createNewSmil(); @Override SmilResponse createNewSmil(MediaPackage mediaPackage); @Override SmilResponse addParallel(Smil smil); @Override SmilResponse addParallel(Smil smil, String parentId); @Override SmilResponse addSequence(Smil smil); @Override SmilResponse addSequence(Smil smil, String parentId); @Override SmilResponse addClip(Smil smil, String parentId, Track track, long start, long duration); @Override SmilResponse addClip(Smil smil, String parentId, Track track, long start, long duration, String pgId); @Override SmilResponse addClips(Smil smil, String parentId, Track[] tracks, long start, long duration); @Override SmilResponse addMeta(Smil smil, String name, String content); @Override SmilResponse removeSmilElement(Smil smil, String elementId); @Override SmilResponse fromXml(String smilXml); @Override SmilResponse fromXml(File smilXmlFile);  }