LiveScheduleServiceImpl implements LiveScheduleService { Track buildStreamingTrack(String uriString, MediaPackageElementFlavor flavor, String mimeType, String resolution, long duration) throws URISyntaxException { URI uri = new URI(uriString); MediaPackageElementBuilder elementBuilder = MediaPackageElementBuilderFactory.newInstance().newElementBuilder(); MediaPackageElement element = elementBuilder.elementFromURI(uri, MediaPackageElement.Type.Track, flavor); TrackImpl track = (TrackImpl) element; track.setDuration(duration); track.setLive(true); track.setMimeType(MimeTypes.parseMimeType(mimeType)); VideoStreamImpl video = new VideoStreamImpl("video-" + flavor.getType() + "-" + flavor.getSubtype()); String[] dimensions = resolution.split("x"); video.setFrameWidth(Integer.parseInt(dimensions[0])); video.setFrameHeight(Integer.parseInt(dimensions[1])); track.addStream(video); logger.debug("Creating live track element of flavor {}, resolution {}, and url {}", new Object[] { flavor, resolution, uriString }); return track; }  @Override boolean createOrUpdateLiveEvent(String mpId, DublinCoreCatalog episodeDC); @Override boolean deleteLiveEvent(String mpId); @Override boolean updateLiveEventAcl(String mpId, AccessControlList acl); void setDublinCoreService(DublinCoreCatalogService service); void setSearchService(SearchService service); void setSeriesService(SeriesService service); void setServiceRegistry(ServiceRegistry service); void setCaptureAgentService(CaptureAgentStateService service); void setDownloadDistributionService(DownloadDistributionService service); void setWorkspace(Workspace ws); void setAssetManager(AssetManager assetManager); void setAuthorizationService(AuthorizationService service); void setOrganizationService(OrganizationDirectoryService service); static final String CA_PROPERTY_RESOLUTION_URL_PREFIX; static final String REPLACE_ID; static final String REPLACE_FLAVOR; static final String REPLACE_CA_NAME; static final String REPLACE_RESOLUTION; static final String LIVE_STREAMING_URL; static final String LIVE_STREAM_NAME; static final String LIVE_STREAM_MIME_TYPE; static final String LIVE_STREAM_RESOLUTION; static final String LIVE_TARGET_FLAVORS; static final String LIVE_DISTRIBUTION_SERVICE; static final String LIVE_PUBLISH_STREAMING; }
@Test public void testBuildStreamingTrack() throws Exception { replayServices(); String uriString = "rtmp: MediaPackageElementFlavor flavor = new MediaPackageElementFlavor("presenter", "delivery"); assertLiveTrack(service.buildStreamingTrack(uriString, flavor, MIME_TYPE, "16x9", DURATION), DURATION, 9, 16); }