本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例5: close
/** {@inheritDoc} */
public void close() {
if (state == StreamState.PLAYING || state == StreamState.PAUSED) {
stop();
}
if (msgOut != null) {
msgOut.unsubscribe(this);
}
notifyBroadcastClose();
setState(StreamState.CLOSED);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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;
}
}
}
}
});
}
示例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;
}
}
});
}