當前位置: 首頁>>代碼示例>>Java>>正文


Java SimplePlayItem.build方法代碼示例

本文整理匯總了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);
        }
    }
}
 
開發者ID:Red5,項目名稱:red5-server-common,代碼行數:51,代碼來源:StreamService.java

示例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);
		}
	}
}
 
開發者ID:cwpenhale,項目名稱:red5-mobileconsole,代碼行數:50,代碼來源:StreamService.java

示例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();
}
 
開發者ID:cwpenhale,項目名稱:red5-mobileconsole,代碼行數:8,代碼來源:PlaylistSubscriberStreamTest.java

示例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);
}
 
開發者ID:cwpenhale,項目名稱:red5-mobileconsole,代碼行數:11,代碼來源:ServerStreamTest.java

示例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()));
}
 
開發者ID:cwpenhale,項目名稱:red5-mobileconsole,代碼行數:13,代碼來源:ServerStreamTest.java

示例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);
}
 
開發者ID:cwpenhale,項目名稱:red5-mobileconsole,代碼行數:11,代碼來源:ServerStreamTest.java

示例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);
}
 
開發者ID:cwpenhale,項目名稱:red5-mobileconsole,代碼行數:10,代碼來源:ServerStreamTest.java

示例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());
}
 
開發者ID:cwpenhale,項目名稱:red5-mobileconsole,代碼行數:8,代碼來源:ServerStreamTest.java

示例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());
}
 
開發者ID:cwpenhale,項目名稱:red5-mobileconsole,代碼行數:12,代碼來源:ServerStreamTest.java

示例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);
}
 
開發者ID:cwpenhale,項目名稱:red5-mobileconsole,代碼行數:7,代碼來源:PlaylistSubscriberStreamTest.java

示例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()));
}
 
開發者ID:cwpenhale,項目名稱:red5-mobileconsole,代碼行數:7,代碼來源:ServerStreamTest.java


注:本文中的org.red5.server.api.stream.support.SimplePlayItem.build方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。