本文整理汇总了Java中org.red5.server.api.stream.support.SimplePlayItem.build方法的典型用法代码示例。如果您正苦于以下问题:Java SimplePlayItem.build方法的具体用法?Java SimplePlayItem.build怎么用?Java SimplePlayItem.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.red5.server.api.stream.support.SimplePlayItem
的用法示例。
在下文中一共展示了SimplePlayItem.build方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
}
}
示例3: 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();
}
示例4: 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);
}
示例5: 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()));
}
示例6: 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);
}
示例7: 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);
}
示例8: 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());
}
示例9: 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());
}
示例10: 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);
}
示例11: 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()));
}