当前位置: 首页>>代码示例>>Java>>正文


Java SimplePlayItem类代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:51,代码来源:StreamService.java

示例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++;
    }
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:14,代码来源:ServerStream.java

示例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);
		}
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:50,代码来源:StreamService.java

示例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++;
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:14,代码来源:ServerStream.java

示例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();
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:8,代码来源:PlaylistSubscriberStreamTest.java

示例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);
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:11,代码来源:ServerStreamTest.java

示例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()));
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:13,代码来源:ServerStreamTest.java

示例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);
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:11,代码来源:ServerStreamTest.java

示例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);
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:10,代码来源:ServerStreamTest.java

示例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());
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:8,代码来源:ServerStreamTest.java

示例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());
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:12,代码来源:ServerStreamTest.java

示例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);
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:7,代码来源:PlaylistSubscriberStreamTest.java

示例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()));
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:7,代码来源:ServerStreamTest.java


注:本文中的org.red5.server.api.stream.support.SimplePlayItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。