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


Java StreamState.PLAYING属性代码示例

本文整理汇总了Java中org.red5.server.api.stream.StreamState.PLAYING属性的典型用法代码示例。如果您正苦于以下问题:Java StreamState.PLAYING属性的具体用法?Java StreamState.PLAYING怎么用?Java StreamState.PLAYING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.red5.server.api.stream.StreamState的用法示例。


在下文中一共展示了StreamState.PLAYING属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stop

/**
 * Stop this server-side stream
 */
public void stop() {
    if (state == StreamState.PLAYING || state == StreamState.PAUSED) {
        if (liveJobName != null) {
            scheduler.removeScheduledJob(liveJobName);
            liveJobName = null;
        }
        if (vodJobName != null) {
            scheduler.removeScheduledJob(vodJobName);
            vodJobName = null;
        }
        if (msgIn != null) {
            msgIn.unsubscribe(this);
            msgIn = null;
        }
        if (nextRTMPMessage != null) {
            nextRTMPMessage.getBody().release();
        }
        stopRecording();
        setState(StreamState.STOPPED);
    }
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:24,代码来源:ServerStream.java

示例2: stop

/**
 * Stop this server-side stream
 */
public void stop() {
	if (state == StreamState.PLAYING || state == StreamState.PAUSED) {
		if (liveJobName != null) {
			scheduler.removeScheduledJob(liveJobName);
			liveJobName = null;
		}
		if (vodJobName != null) {
			scheduler.removeScheduledJob(vodJobName);
			vodJobName = null;
		}
		if (msgIn != null) {
			msgIn.unsubscribe(this);
			msgIn = null;
		}
		if (nextRTMPMessage != null) {
			nextRTMPMessage.getBody().release();
		}
		setState(StreamState.STOPPED);
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:23,代码来源:ServerStream.java

示例3: ensurePullAndPushRunning

/**
 * Make sure the pull and push processing is running.
 */
private void ensurePullAndPushRunning() {
    log.trace("State should be PLAYING to running this task: {}", subscriberStream.getState());
    if (pullMode && pullAndPush == null && subscriberStream.getState() == StreamState.PLAYING) {
        // client buffer is at least 100ms
        pullAndPush = subscriberStream.scheduleWithFixedDelay(new PullAndPushRunnable(), 10);
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:10,代码来源:PlayEngine.java

示例4: seek

/** {@inheritDoc} */
public void seek(int position) {
    // seek only allowed when playing or paused
    if (state == StreamState.PLAYING || state == StreamState.PAUSED) {
        sendVODSeekCM(msgIn, position);
    }
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:7,代码来源:ServerStream.java

示例5: close

/** {@inheritDoc} */
public void close() {
    if (state == StreamState.PLAYING || state == StreamState.PAUSED) {
        stop();
    }
    if (msgOut != null) {
        msgOut.unsubscribe(this);
    }
    notifyBroadcastClose();
    setState(StreamState.CLOSED);
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:11,代码来源:ServerStream.java

示例6: ensurePullAndPushRunning

/**
 * Make sure the pull and push processing is running.
 */
private void ensurePullAndPushRunning() {
	log.trace("State should be PLAYING to running this task: {}", subscriberStream.getState());
	if (pullMode && pullAndPushFuture == null && subscriberStream.getState() == StreamState.PLAYING) {
		// client buffer is at least 100ms
		pullAndPushFuture = subscriberStream.getExecutor().scheduleWithFixedDelay(new PullAndPushRunnable(), 0, 10, TimeUnit.MILLISECONDS);
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:10,代码来源:PlayEngine.java

示例7: seek

/** {@inheritDoc} */
public void seek(int position) {
	// seek only allowed when playing or paused
	if (state == StreamState.PLAYING || state == StreamState.PAUSED) {
		sendVODSeekCM(msgIn, position);
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:7,代码来源:ServerStream.java

示例8: close

/** {@inheritDoc} */
public void close() {
	if (state == StreamState.PLAYING || state == StreamState.PAUSED) {
		stop();
	}
	if (msgOut != null) {
		msgOut.unsubscribe(this);
	}
	recordPipe.unsubscribe((IProvider) this);
	notifyBroadcastClose();
	setState(StreamState.CLOSED);
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:12,代码来源:ServerStream.java

示例9: scheduleNextMessage

/**
 * Pull the next message from IMessageInput and schedule it for push according to the timestamp.
 */
protected void scheduleNextMessage() {
    boolean first = (nextRTMPMessage == null);
    long delta = 0L;
    do {
        nextRTMPMessage = getNextRTMPMessage();
        if (nextRTMPMessage != null) {
            IRTMPEvent rtmpEvent = nextRTMPMessage.getBody();
            // filter all non-AV messages
            if (rtmpEvent instanceof VideoData || rtmpEvent instanceof AudioData) {
                rtmpEvent = nextRTMPMessage.getBody();
                nextTS = rtmpEvent.getTimestamp();
                if (first) {
                    vodStartTS = nextTS;
                    first = false;
                }
                delta = nextTS - vodStartTS - (System.currentTimeMillis() - serverStartTS);
                if (delta < WAIT_THRESHOLD) {
                    if (doPushMessage()) {
                        if (state != StreamState.PLAYING) {
                            // Stream is not playing, don't load more messages
                            nextRTMPMessage = null;
                        }
                    } else {
                        nextRTMPMessage = null;
                    }
                }
            }
        } else {
            onItemEnd();
        }
    } while (nextRTMPMessage != null || delta < WAIT_THRESHOLD);
    // start the job all over again
    vodJobName = scheduler.addScheduledOnceJob(delta, new IScheduledJob() {
        public void execute(ISchedulingService service) {
            if (vodJobName != null) {
                vodJobName = null;
                if (doPushMessage()) {
                    if (state == StreamState.PLAYING) {
                        scheduleNextMessage();
                    } else {
                        // Stream is paused, don't load more messages
                        nextRTMPMessage = null;
                    }
                }
            }
        }
    });
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:51,代码来源:ServerStream.java

示例10: scheduleNextMessage

/**
 * Pull the next message from IMessageInput and schedule
 * it for push according to the timestamp.
 */
protected void scheduleNextMessage() {
	boolean first = nextRTMPMessage == null;
	long delta;
	while (true) {
		nextRTMPMessage = getNextRTMPMessage();
		if (nextRTMPMessage == null) {
			onItemEnd();
			return;
		}
		IRTMPEvent rtmpEvent = nextRTMPMessage.getBody();
		// filter all non-AV messages
		if (!(rtmpEvent instanceof VideoData) && !(rtmpEvent instanceof AudioData)) {
			continue;
		}
		rtmpEvent = nextRTMPMessage.getBody();
		nextTS = rtmpEvent.getTimestamp();
		if (first) {
			vodStartTS = nextTS;
			first = false;
		}
		delta = nextTS - vodStartTS - (System.currentTimeMillis() - serverStartTS);
		if (delta < WAIT_THRESHOLD) {
			if (!doPushMessage()) {
				return;
			}
			if (state != StreamState.PLAYING) {
				// Stream is not playing, don't load more messages
				nextRTMPMessage = null;
				return;
			}
		} else {
			break;
		}
	}
	vodJobName = scheduler.addScheduledOnceJob(delta, new IScheduledJob() {
		/** {@inheritDoc} */
		public void execute(ISchedulingService service) {
			if (vodJobName == null) {
				return;
			}
			vodJobName = null;
			if (!doPushMessage()) {
				return;
			}
			if (state == StreamState.PLAYING) {
				scheduleNextMessage();
			} else {
				// Stream is paused, don't load more messages
				nextRTMPMessage = null;
			}
		}
	});
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:57,代码来源:ServerStream.java


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