Examples of IPlayItem


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

          // clean up
          simplePlayback.remove();
        }
      } else if ("append".equals(transition) || "appendAndWait".equals(transition)) {
        IPlaylistSubscriberStream playlistStream = (IPlaylistSubscriberStream) streamConn.getStreamById(streamId);
        IPlayItem item = SimplePlayItem.build(streamName);
        playlistStream.addItem(item);
        if ("append".equals(transition)) {
          play(streamName, start, length, false);
        }
      } else if ("swap".equals(transition)) {
        IPlaylistSubscriberStream playlistStream = (IPlaylistSubscriberStream) streamConn.getStreamById(streamId);
        IPlayItem item = SimplePlayItem.build(streamName);
        int itemCount = playlistStream.getItemSize();
        for (int i = 0; i < itemCount; i++) {
          IPlayItem tmpItem = playlistStream.getItem(i);
          if (tmpItem.getName().equals(oldStreamName)) {
            if (!playlistStream.replace(tmpItem, item)) {
              log.warn("Playlist item replacement failed");
              sendNSFailed(streamConn, StatusCodes.NS_PLAY_FAILED, "Playlist swap failed.", streamName, streamId);
            }
            break;
View Full Code Here

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

    if (currentItemIndex == -1) {
      moveToNext();
    }
    // If there's some more items on list then play current item
    while (count-- > 0) {
      IPlayItem item = null;
      read.lock();
      try {
        // Get playlist item
        item = items.get(currentItemIndex);
        engine.play(item);
View Full Code Here

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

    stop();
    moveToPrevious();
    if (currentItemIndex == -1) {
      return;
    }
    IPlayItem item = null;
    int count = items.size();
    while (count-- > 0) {
      read.lock();
      try {
        item = items.get(currentItemIndex);
View Full Code Here

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

  public void nextItem() {
    moveToNext();
    if (currentItemIndex == -1) {
      return;
    }
    IPlayItem item = null;
    int count = items.size();
    while (count-- > 0) {
      read.lock();
      try {
        item = items.get(currentItemIndex);
View Full Code Here

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

    }
    stop();
    currentItemIndex = index;
    read.lock();
    try {
      IPlayItem item = items.get(currentItemIndex);
      engine.play(item);
    } catch (IOException e) {
      log.error("setItem caught a IOException", e);
    } catch (StreamNotFoundException e) {
      // let the engine retain the STOPPED state
View Full Code Here

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

          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);
              }
View Full Code Here

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

            // Move to next if current item is set to -1
            if (currentItemIndex == -1) {
        moveToNext();
      }
            // Get playlist item
            IPlayItem item = items.get(currentItemIndex);
            // Check how many is yet to play...
            int count = items.size();
            // If there's some more items on list then play current item
            while (count-- > 0) {
        try {
View Full Code Here

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

      stop();
      moveToPrevious();
      if (currentItemIndex == -1) {
        return;
      }
      IPlayItem item = items.get(currentItemIndex);
      int count = items.size();
      while (count-- > 0) {
        try {
          engine.play(item);
          break;
View Full Code Here

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

    synchronized (items) {
      moveToNext();
      if (currentItemIndex == -1) {
        return;
      }
      IPlayItem item = items.get(currentItemIndex);
      int count = items.size();
      while (count-- > 0) {
        try {
          engine.play(item, false);
          break;
View Full Code Here

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

      if (index < 0 || index >= items.size()) {
        return;
      }
      stop();
      currentItemIndex = index;
      IPlayItem item = items.get(currentItemIndex);
      try {
        engine.play(item);
      } catch (IOException e) {
        log.error("setItem caught a IOException", e);
      } catch (StreamNotFoundException e) {
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.