Exemplo n.º 1
0
  public void start() throws MediaException {

    // System.out.println("START REQUEST: "+this);

    if (state == CLOSED) {
      throw new IllegalStateException();
    }

    if (state == STARTED) return;

    if (state == UNREALIZED || state == REALIZED) {
      prefetch();
    }
    try {
      startImpl();
      ApplicationManager.getInstance().activePlayers.addElement(this);
    } catch (MediaException e) {
      throw e;
    } catch (Exception e) {
      e.printStackTrace();
      throw new MediaException(e.toString());
    }

    state = STARTED;
    if (autoNotify) {
      startListenerNotification(PlayerListener.STARTED, null);
    }
  }
Exemplo n.º 2
0
 public void stop() throws MediaException {
   // System.out.println("MMPlayer stop called");
   if (state == CLOSED) throw new IllegalStateException();
   if (state != STARTED) return;
   try {
     stopImpl();
     ApplicationManager.getInstance().activePlayers.removeElement(this);
   } catch (Exception e) {
     e.printStackTrace();
     throw new MediaException(e.toString());
   }
   state = PREFETCHED;
   if (autoNotify) {
     startListenerNotification(PlayerListener.STOPPED, null);
   }
 }