Examples of IStreamAwareScopeHandler


Examples of org.red5.server.api.stream.IStreamAwareScopeHandler

   */
  protected void startBroadcastVOD() {
    nextRTMPMessage = null;
    vodStartTS = 0;
    serverStartTS = System.currentTimeMillis();
    IStreamAwareScopeHandler handler = getStreamAwareHandler();
    if (handler != null) {
      if (recordingListener != null && recordingListener.get().isRecording()) {
        // callback for record start
        handler.streamRecordStart(this);
      } else {
        // callback for publish start
        handler.streamPublishStart(this);
      }
    }
    notifyBroadcastStart();
    scheduleNextMessage();
  }
View Full Code Here

Examples of org.red5.server.api.stream.IStreamAwareScopeHandler

  /**
   *  Notifies handler on stream broadcast stop
   */
  protected void notifyBroadcastClose() {
    IStreamAwareScopeHandler handler = getStreamAwareHandler();
    if (handler != null) {
      try {
        handler.streamBroadcastClose(this);
      } catch (Throwable t) {
        log.error("error notify streamBroadcastStop", t);
      }
    }
  }
View Full Code Here

Examples of org.red5.server.api.stream.IStreamAwareScopeHandler

  /**
   *  Notifies handler on stream recording stop
   */
  private void notifyRecordingStop() {
    IStreamAwareScopeHandler handler = getStreamAwareHandler();
    if (handler != null) {
      try {
        handler.streamRecordStop(this);
      } catch (Throwable t) {
        log.error("Error in notifyBroadcastClose", t);
      }
    }
  } 
View Full Code Here

Examples of org.red5.server.api.stream.IStreamAwareScopeHandler

 
  /**
   *  Notifies handler on stream broadcast start
   */
  protected void notifyBroadcastStart() {
    IStreamAwareScopeHandler handler = getStreamAwareHandler();
    if (handler != null) {
      try {
        handler.streamBroadcastStart(this);
      } catch (Throwable t) {
        log.error("error notify streamBroadcastStart", t);
      }
    }
  }
View Full Code Here

Examples of org.red5.server.api.stream.IStreamAwareScopeHandler

  /**
   *  Notifies handler on stream recording stop
   */
  private void notifyRecordingStop() {
    IStreamAwareScopeHandler handler = getStreamAwareHandler();
    if (handler != null) {
      try {
        handler.streamRecordStop(this);
      } catch (Throwable t) {
        log.error("Error in notifyBroadcastClose", t);
      }
    }
  }
View Full Code Here

Examples of org.red5.server.api.stream.IStreamAwareScopeHandler

  /**
   *  Notifies handler on stream broadcast start
   */
  private void notifyBroadcastStart() {
    IStreamAwareScopeHandler handler = getStreamAwareHandler();
    if (handler != null) {
      try {
        handler.streamBroadcastStart(this);
      } catch (Throwable t) {
        log.error("Error in notifyBroadcastStart", t);
      }
    }
  }
View Full Code Here

Examples of org.red5.server.api.stream.IStreamAwareScopeHandler

  /**
   * {@inheritDoc}
   */
  public void onChange(final StreamState state, final Object... changed) {
    Notifier notifier = null;
    IStreamAwareScopeHandler handler = getStreamAwareHandler();
    switch (state) {
      case SEEK:
        //notifies subscribers on seek
        if (handler != null) {
          notifier = new Notifier(this, handler) {
            public void execute(ISchedulingService service) {
              //make sure those notified have the correct connection
              Red5.setConnectionLocal(conn);
              //get item being played
              IPlayItem item = (IPlayItem) changed[0];
              //seek position
              int position = (Integer) changed[1];
              try {
                handler.streamPlayItemSeek(stream, item, position);
              } catch (Throwable t) {
                log.error("error notify streamPlayItemSeek", t);
              }
              // clear thread local reference
              Red5.setConnectionLocal(null);
            }
          };
        }
        break;
      case PAUSED:
        //set the paused state
        this.setState(StreamState.PAUSED);
        //notifies subscribers on pause
        if (handler != null) {
          notifier = new Notifier(this, handler) {
            public void execute(ISchedulingService service) {
              //make sure those notified have the correct connection
              Red5.setConnectionLocal(conn);
              //get item being played
              IPlayItem item = (IPlayItem) changed[0];
              //playback position
              int position = (Integer) changed[1];
              try {
                handler.streamPlayItemPause(stream, item, position);
              } catch (Throwable t) {
                log.error("error notify streamPlayItemPause", t);
              }
              // clear thread local reference
              Red5.setConnectionLocal(null);
            }
          };
        }
        break;
      case RESUMED:
        //resume playing
        this.setState(StreamState.PLAYING);
        //notifies subscribers on resume
        if (handler != null) {
          notifier = new Notifier(this, handler) {
            public void execute(ISchedulingService service) {
              //make sure those notified have the correct connection
              Red5.setConnectionLocal(conn);
              //get item being played
              IPlayItem item = (IPlayItem) changed[0];
              //playback position
              int position = (Integer) changed[1];
              try {
                handler.streamPlayItemResume(stream, item, position);
              } catch (Throwable t) {
                log.error("error notify streamPlayItemResume", t);
              }
              // clear thread local reference
              Red5.setConnectionLocal(null);
            }
          };
        }
        break;
      case PLAYING:
        //notifies subscribers on play
        if (handler != null) {
          notifier = new Notifier(this, handler) {
            public void execute(ISchedulingService service) {
              //make sure those notified have the correct connection
              Red5.setConnectionLocal(conn);
              //get item being played
              IPlayItem item = (IPlayItem) changed[0];
              //is it a live broadcast
              boolean isLive = (Boolean) changed[1];
              try {
                handler.streamPlayItemPlay(stream, item, isLive);
              } catch (Throwable t) {
                log.error("error notify streamPlayItemPlay", t);
              }
              // clear thread local reference
              Red5.setConnectionLocal(null);
            }
          };
        }
        break;
      case CLOSED:
        //notifies subscribers on close
        if (handler != null) {
          notifier = new Notifier(this, handler) {
            public void execute(ISchedulingService service) {
              //make sure those notified have the correct connection
              Red5.setConnectionLocal(conn);
              try {
                handler.streamSubscriberClose(stream);
              } catch (Throwable t) {
                log.error("error notify streamSubscriberClose", t);
              }
              // clear thread local reference
              Red5.setConnectionLocal(null);
            }
          };
        }
        break;
      case STARTED:
        //notifies subscribers on start
        if (handler != null) {
          notifier = new Notifier(this, handler) {
            public void execute(ISchedulingService service) {
              //make sure those notified have the correct connection
              Red5.setConnectionLocal(conn);
              try {
                handler.streamSubscriberStart(stream);
              } catch (Throwable t) {
                log.error("error notify streamSubscriberStart", t);
              }
              // clear thread local reference
              Red5.setConnectionLocal(null);
            }
          };
        }
        break;
      case STOPPED:
        //set the stopped state
        this.setState(StreamState.STOPPED);
        //notifies subscribers on stop
        if (handler != null) {
          notifier = new Notifier(this, handler) {
            public void execute(ISchedulingService service) {
              //make sure those notified have the correct connection
              Red5.setConnectionLocal(conn);
              //get the item that was stopped
              IPlayItem item = (IPlayItem) changed[0];
              try {
                handler.streamPlayItemStop(stream, item);
              } catch (Throwable t) {
                log.error("error notify streamPlaylistItemStop", t);
              }
              // clear thread local reference
              Red5.setConnectionLocal(null);
View Full Code Here

Examples of org.red5.server.api.stream.IStreamAwareScopeHandler

  /**
   *  Notifies handler on stream broadcast close
   */
  private void notifyBroadcastClose() {
    final IStreamAwareScopeHandler handler = getStreamAwareHandler();
    if (handler != null) {
      try {
        handler.streamBroadcastClose(this);
      } catch (Throwable t) {
        log.error("Error in notifyBroadcastClose", t);
      }
    }
  }
View Full Code Here

Examples of org.red5.server.api.stream.IStreamAwareScopeHandler

  /**
   * {@inheritDoc}
   */
  public void onChange(final StreamState state, final Object... changed) {
    Notifier notifier = null;
    IStreamAwareScopeHandler handler = getStreamAwareHandler();
    switch (state) {
      case SEEK:
        //notifies subscribers on seek
        if (handler != null) {
          notifier = new Notifier(this, handler) {
            public void execute(ISchedulingService service) {
              //make sure those notified have the correct connection
              Red5.setConnectionLocal(conn);
              //get item being played
              IPlayItem item = (IPlayItem) changed[0];
              //seek position
              int position = (Integer) changed[1];
              try {
                handler.streamPlayItemSeek(stream, item, position);
              } catch (Throwable t) {
                log.error("error notify streamPlayItemSeek", t);
              }
              // clear thread local reference
              Red5.setConnectionLocal(null);
            }
          };
        }
        break;
      case PAUSED:
        //set the paused state
        this.setState(StreamState.PAUSED);
        //notifies subscribers on pause
        if (handler != null) {
          notifier = new Notifier(this, handler) {
            public void execute(ISchedulingService service) {
              //make sure those notified have the correct connection
              Red5.setConnectionLocal(conn);
              //get item being played
              IPlayItem item = (IPlayItem) changed[0];
              //playback position
              int position = (Integer) changed[1];
              try {
                handler.streamPlayItemPause(stream, item, position);
              } catch (Throwable t) {
                log.error("error notify streamPlayItemPause", t);
              }
              // clear thread local reference
              Red5.setConnectionLocal(null);
            }
          };
        }
        break;
      case RESUMED:
        //resume playing
        this.setState(StreamState.PLAYING);
        //notifies subscribers on resume
        if (handler != null) {
          notifier = new Notifier(this, handler) {
            public void execute(ISchedulingService service) {
              //make sure those notified have the correct connection
              Red5.setConnectionLocal(conn);
              //get item being played
              IPlayItem item = (IPlayItem) changed[0];
              //playback position
              int position = (Integer) changed[1];
              try {
                handler.streamPlayItemResume(stream, item, position);
              } catch (Throwable t) {
                log.error("error notify streamPlayItemResume", t);
              }
              // clear thread local reference
              Red5.setConnectionLocal(null);
            }
          };
        }
        break;
      case PLAYING:
        //notifies subscribers on play
        if (handler != null) {
          notifier = new Notifier(this, handler) {
            public void execute(ISchedulingService service) {
              //make sure those notified have the correct connection
              Red5.setConnectionLocal(conn);
              //get item being played
              IPlayItem item = (IPlayItem) changed[0];
              //is it a live broadcast
              boolean isLive = (Boolean) changed[1];
              try {
                handler.streamPlayItemPlay(stream, item, isLive);
              } catch (Throwable t) {
                log.error("error notify streamPlayItemPlay", t);
              }
              // clear thread local reference
              Red5.setConnectionLocal(null);
            }
          };
        }
        break;
      case CLOSED:
        //notifies subscribers on close
        if (handler != null) {
          notifier = new Notifier(this, handler) {
            public void execute(ISchedulingService service) {
              //make sure those notified have the correct connection
              Red5.setConnectionLocal(conn);
              try {
                handler.streamSubscriberClose(stream);
              } catch (Throwable t) {
                log.error("error notify streamSubscriberClose", t);
              }
              // clear thread local reference
              Red5.setConnectionLocal(null);
            }
          };
        }
        break;
      case STARTED:
        //notifies subscribers on start
        if (handler != null) {
          notifier = new Notifier(this, handler) {
            public void execute(ISchedulingService service) {
              //make sure those notified have the correct connection
              Red5.setConnectionLocal(conn);
              try {
                handler.streamSubscriberStart(stream);
              } catch (Throwable t) {
                log.error("error notify streamSubscriberStart", t);
              }
              // clear thread local reference
              Red5.setConnectionLocal(null);
            }
          };
        }
        break;
      case STOPPED:
        //set the stopped state
        this.setState(StreamState.STOPPED);
        //notifies subscribers on stop
        if (handler != null) {
          notifier = new Notifier(this, handler) {
            public void execute(ISchedulingService service) {
              //make sure those notified have the correct connection
              Red5.setConnectionLocal(conn);
              //get the item that was stopped
              IPlayItem item = (IPlayItem) changed[0];
              try {
                handler.streamPlayItemStop(stream, item);
              } catch (Throwable t) {
                log.error("error notify streamPlaylistItemStop", t);
              }
              // clear thread local reference
              Red5.setConnectionLocal(null);
View Full Code Here

Examples of org.red5.server.api.stream.IStreamAwareScopeHandler

    /**
     * Notifies subscribers on start
     */
    private void notifySubscriberStart() {
    IStreamAwareScopeHandler handler = getStreamAwareHandler();
    if (handler != null) {
      try {
        handler.streamSubscriberStart(this);
      } catch (Throwable t) {
        log.error("error notify streamSubscriberStart", t);
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.