Search in sources :

Example 1 with SmilMediaSequenceImpl

use of org.opencastproject.smil.entity.media.container.SmilMediaSequenceImpl in project opencast by opencast.

the class SmilServiceImpl method addSequence.

/**
 * {@inheritDoc}
 */
@Override
public SmilResponse addSequence(Smil smil, String parentId) throws SmilException {
    SmilMediaContainer seq = new SmilMediaSequenceImpl();
    ((SmilBodyImpl) smil.getBody()).addMediaElement(seq, parentId);
    return new SmilResponseImpl(smil, seq);
}
Also used : SmilMediaSequenceImpl(org.opencastproject.smil.entity.media.container.SmilMediaSequenceImpl) SmilBodyImpl(org.opencastproject.smil.entity.SmilBodyImpl) SmilMediaContainer(org.opencastproject.smil.entity.media.container.api.SmilMediaContainer)

Example 2 with SmilMediaSequenceImpl

use of org.opencastproject.smil.entity.media.container.SmilMediaSequenceImpl in project opencast by opencast.

the class SmilServiceImplTest method testAddSequence.

/**
 * Test of addSequence methods, of class SmilServiceImpl.
 */
@Test
public void testAddSequence() throws Exception {
    SmilResponse smilResponse = smilService.createNewSmil();
    smilResponse = smilService.addSequence(smilResponse.getSmil());
    assertNotNull(smilResponse.getSmil().getBody().getMediaElements().get(0));
    assertEquals(smilResponse.getSmil().getBody().getMediaElements().get(0), smilResponse.getEntity());
    assertTrue(smilResponse.getSmil().getBody().getMediaElements().get(0) instanceof SmilMediaSequenceImpl);
    SmilMediaContainer par = (SmilMediaContainer) smilResponse.getEntity();
    assertTrue(par.isContainer());
    assertSame(SmilMediaContainer.ContainerType.SEQ, par.getContainerType());
    smilResponse = smilService.addSequence(smilResponse.getSmil(), smilResponse.getEntity().getId());
    assertNotNull(smilResponse.getSmil().getBody().getMediaElements().get(0));
    assertTrue(smilResponse.getSmil().getBody().getMediaElements().get(0) instanceof SmilMediaSequenceImpl);
    SmilMediaContainer parent = (SmilMediaContainer) smilResponse.getSmil().getBody().getMediaElements().get(0);
    assertNotNull(parent.getElements().get(0));
    assertTrue(parent.getElements().get(0) instanceof SmilMediaSequenceImpl);
    assertEquals(parent.getElements().get(0).getId(), smilResponse.getEntity().getId());
// logger.info(((SmilImpl)smilResponse.getSmil()).toXML());
}
Also used : SmilResponse(org.opencastproject.smil.api.SmilResponse) SmilMediaSequenceImpl(org.opencastproject.smil.entity.media.container.SmilMediaSequenceImpl) SmilMediaContainer(org.opencastproject.smil.entity.media.container.api.SmilMediaContainer) Test(org.junit.Test)

Aggregations

SmilMediaSequenceImpl (org.opencastproject.smil.entity.media.container.SmilMediaSequenceImpl)2 SmilMediaContainer (org.opencastproject.smil.entity.media.container.api.SmilMediaContainer)2 Test (org.junit.Test)1 SmilResponse (org.opencastproject.smil.api.SmilResponse)1 SmilBodyImpl (org.opencastproject.smil.entity.SmilBodyImpl)1