本文整理汇总了Java中org.red5.server.api.stream.support.SimplePlayItem类的典型用法代码示例。如果您正苦于以下问题:Java SimplePlayItem类的具体用法?Java SimplePlayItem怎么用?Java SimplePlayItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimplePlayItem类属于org.red5.server.api.stream.support包,在下文中一共展示了SimplePlayItem类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: play
import org.red5.server.api.stream.support.SimplePlayItem; //导入依赖的package包/类
/**
* Plays back a stream based on the supplied name, from the specified position for the given length of time.
*
* @param name
* - The name of a recorded file, or the identifier for live data. If
* @param start
* - The start time, in seconds. Allowed values are -2, -1, 0, or a positive number. The default value is -2, which looks for
* a live stream, then a recorded stream, and if it finds neither, opens a live stream. If -1, plays only a live stream. If 0
* or a positive number, plays a recorded stream, beginning start seconds in.
* @param length
* - The duration of the playback, in seconds. Allowed values are -1, 0, or a positive number. The default value is -1, which
* plays a live or recorded stream until it ends. If 0, plays a single frame that is start seconds from the beginning of a
* recorded stream. If a positive number, plays a live or recorded stream for length seconds.
* @param reset
* - Whether to clear a playlist. The default value is 1 or true, which clears any previous play calls and plays name
* immediately. If 0 or false, adds the stream to a playlist. If 2, maintains the playlist and returns all stream messages at
* once, rather than at intervals. If 3, clears the playlist and returns all stream messages at once.
*/
public void play(String name, int start, int length, Object reset) {
if (reset instanceof Boolean) {
play(name, start, length, ((Boolean) reset).booleanValue());
} else {
if (reset instanceof Integer) {
int value = (Integer) reset;
switch (value) {
case 0:
//adds the stream to a playlist
IStreamCapableConnection streamConn = (IStreamCapableConnection) Red5.getConnectionLocal();
IPlaylistSubscriberStream playlistStream = (IPlaylistSubscriberStream) streamConn.getStreamById(streamConn.getStreamId());
IPlayItem item = SimplePlayItem.build(name);
playlistStream.addItem(item);
play(name, start, length, false);
break;
case 2:
//maintains the playlist and returns all stream messages at once, rather than at intervals
break;
case 3:
//clears the playlist and returns all stream messages at once
break;
default:
//clears any previous play calls and plays name immediately
play(name, start, length, true);
}
} else {
play(name, start, length);
}
}
}
示例2: addItem
import org.red5.server.api.stream.support.SimplePlayItem; //导入依赖的package包/类
/** {@inheritDoc} */
public void addItem(IPlayItem item, int index) {
IPlayItem prev = items.get(index);
if (prev != null && prev instanceof SimplePlayItem) {
// since it replaces the item in the current spot, reset the items time so the sort will work
((SimplePlayItem) item).setCreated(((SimplePlayItem) prev).getCreated() - 1);
}
items.add(index, item);
if (index <= currentItemIndex) {
// item was added before the currently playing
currentItemIndex++;
}
}
示例3: play
import org.red5.server.api.stream.support.SimplePlayItem; //导入依赖的package包/类
/**
* Plays back a stream based on the supplied name, from the specified position for the given length of time.
*
* @param name - The name of a recorded file, or the identifier for live data. If
* @param start - The start time, in seconds. Allowed values are -2, -1, 0, or a positive number.
* The default value is -2, which looks for a live stream, then a recorded stream, and if it finds neither,
* opens a live stream. If -1, plays only a live stream. If 0 or a positive number, plays a recorded stream,
* beginning start seconds in.
* @param length - The duration of the playback, in seconds. Allowed values are -1, 0, or a positive number.
* The default value is -1, which plays a live or recorded stream until it ends. If 0, plays a single frame
* that is start seconds from the beginning of a recorded stream. If a positive number, plays a live or recorded
* stream for length seconds.
* @param reset - Whether to clear a playlist. The default value is 1 or true, which clears any previous play
* calls and plays name immediately. If 0 or false, adds the stream to a playlist. If 2, maintains the playlist
* and returns all stream messages at once, rather than at intervals. If 3, clears the playlist and returns all
* stream messages at once.
*/
public void play(String name, int start, int length, Object reset) {
if (reset instanceof Boolean) {
play(name, start, length, ((Boolean) reset).booleanValue());
} else {
if (reset instanceof Integer) {
int value = (Integer) reset;
switch (value) {
case 0:
//adds the stream to a playlist
IStreamCapableConnection streamConn = (IStreamCapableConnection) Red5.getConnectionLocal();
IPlaylistSubscriberStream playlistStream = (IPlaylistSubscriberStream) streamConn.getStreamById(getCurrentStreamId());
IPlayItem item = SimplePlayItem.build(name);
playlistStream.addItem(item);
play(name, start, length, false);
break;
case 2:
//maintains the playlist and returns all stream messages at once, rather than at intervals
break;
case 3:
//clears the playlist and returns all stream messages at once
break;
default:
//clears any previous play calls and plays name immediately
play(name, start, length, true);
}
} else {
play(name, start, length);
}
}
}
示例4: addItem
import org.red5.server.api.stream.support.SimplePlayItem; //导入依赖的package包/类
/** {@inheritDoc} */
public void addItem(IPlayItem item, int index) {
IPlayItem prev = items.get(index);
if (prev != null && prev instanceof SimplePlayItem) {
// since it replaces the item in the current spot, reset the items time so the sort will work
((SimplePlayItem) item).setCreated(((SimplePlayItem) prev).getCreated() - 1);
}
items.add(index, item);
if (index <= currentItemIndex) {
// item was added before the currently playing
currentItemIndex++;
}
}
示例5: testStart
import org.red5.server.api.stream.support.SimplePlayItem; //导入依赖的package包/类
@Test
public void testStart() {
System.out.println("testStart");
SimplePlayItem item = SimplePlayItem.build("DarkKnight.flv");
pss.addItem(item);
pss.start();
}
示例6: testAddItemIPlayItem
import org.red5.server.api.stream.support.SimplePlayItem; //导入依赖的package包/类
@Test
public void testAddItemIPlayItem() {
SimplePlayItem item = SimplePlayItem.build("f1");
serverStream.addItem(item);
assertTrue(serverStream.getCurrentItemIndex() == 0);
SimplePlayItem item2 = SimplePlayItem.build("f2");
serverStream.addItem(item2);
assertTrue(serverStream.getCurrentItemIndex() == 0);
assertTrue(serverStream.getItemSize() == 2);
}
示例7: testAddItemIPlayItemInt
import org.red5.server.api.stream.support.SimplePlayItem; //导入依赖的package包/类
@Test
public void testAddItemIPlayItemInt() {
SimplePlayItem item = SimplePlayItem.build("f1");
serverStream.addItem(item);
SimplePlayItem item2 = SimplePlayItem.build("f2");
serverStream.addItem(item2);
SimplePlayItem item3 = SimplePlayItem.build("f3");
serverStream.addItem(item3, 0);
System.out.println("Items: " + ((ServerStream) serverStream).getItems());
assertTrue(serverStream.getItemSize() == 3);
assertTrue("f1".equals(serverStream.getItem(1).getName()));
}
示例8: testRemoveItem
import org.red5.server.api.stream.support.SimplePlayItem; //导入依赖的package包/类
@Test
public void testRemoveItem() {
SimplePlayItem item = SimplePlayItem.build("f1");
serverStream.addItem(item);
SimplePlayItem item2 = SimplePlayItem.build("f2");
serverStream.addItem(item2);
assertTrue(serverStream.getItemSize() == 2);
serverStream.removeItem(0);
assertTrue(serverStream.getItemSize() == 1);
}
示例9: testRemoveAllItems
import org.red5.server.api.stream.support.SimplePlayItem; //导入依赖的package包/类
@Test
public void testRemoveAllItems() {
SimplePlayItem item = SimplePlayItem.build("f1");
serverStream.addItem(item);
assertTrue(serverStream.getItemSize() == 1);
serverStream.removeAllItems();
assertTrue(serverStream.getItemSize() == 0);
assertTrue(serverStream.getCurrentItemIndex() == 0);
}
示例10: testGetCurrentItem
import org.red5.server.api.stream.support.SimplePlayItem; //导入依赖的package包/类
@Test
public void testGetCurrentItem() {
SimplePlayItem item = SimplePlayItem.build("f1");
serverStream.addItem(item);
serverStream.start();
assertEquals(item, serverStream.getCurrentItem());
}
示例11: testNextItem
import org.red5.server.api.stream.support.SimplePlayItem; //导入依赖的package包/类
@Test
public void testNextItem() {
SimplePlayItem item = SimplePlayItem.build("f1");
serverStream.addItem(item);
SimplePlayItem item2 = SimplePlayItem.build("f2");
serverStream.addItem(item2);
serverStream.start();
serverStream.nextItem();
assertEquals(1, serverStream.getCurrentItemIndex());
assertEquals("f2", serverStream.getCurrentItem().getName());
}
示例12: testAddItemIPlayItem
import org.red5.server.api.stream.support.SimplePlayItem; //导入依赖的package包/类
@Test
public void testAddItemIPlayItem() {
System.out.println("testAddItemIPlayItem");
SimplePlayItem item = SimplePlayItem.build("IronMan.flv");
pss.addItem(item);
}
示例13: testGetItem
import org.red5.server.api.stream.support.SimplePlayItem; //导入依赖的package包/类
@Test
public void testGetItem() {
SimplePlayItem item = SimplePlayItem.build("f1");
serverStream.addItem(item);
assertTrue("f1".equals(serverStream.getItem(0).getName()));
}