Codota Logo
NoPlayer
Code IndexAdd Codota to your IDE (free)

How to use
NoPlayer
in
com.novoda.noplayer

Best Java code snippets using com.novoda.noplayer.NoPlayer (Showing top 17 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: novoda/no-player

  @Override
  public void perform() {
    if (noPlayer.isPlaying()) {
      noPlayer.pause();
    } else {
      noPlayer.play();
    }
  }
};
origin: novoda/no-player

  @Override
  public void onBeat(NoPlayer player) {
    long positionInMillis = player.playheadPositionInMillis();
    long durationInMillis = player.mediaDurationInMillis();
    int bufferPercentage = player.bufferPercentage();
    updateProgress(positionInMillis, durationInMillis, bufferPercentage);
    updateTiming(positionInMillis, durationInMillis);
  }
};
origin: novoda/no-player

  @Override
  public void onClick(DialogInterface dialog, int position) {
    if (position == AUTO_TRACK_POSITION) {
      noPlayer.clearAudioTrackSelection();
    } else {
      PlayerAudioTrack audioTrack = audioTracks.get(position - 1);
      noPlayer.selectAudioTrack(audioTrack);
    }
  }
})
origin: novoda/no-player

  @Override
  public void onClick(DialogInterface dialog, int position) {
    if (position == AUTO_TRACK_POSITION) {
      noPlayer.clearVideoTrackSelection();
    } else {
      PlayerVideoTrack videoTrack = videoTracks.get(position - 1);
      noPlayer.selectVideoTrack(videoTrack);
    }
  }
})
origin: novoda/no-player

@Test
public void givenStatusIsNotCorrupted_whenALayoutChangeOccurs_thenDoNotForceAlignNativeMediaPlayerStatus() {
  when(player.isPlaying()).thenReturn(false);
  onLayoutChange();
  verify(player, never()).play();
}
origin: novoda/no-player

private boolean mediaPlayerIsUnavailable(NoPlayer player) {
  try {
    return !player.isPlaying();
  } catch (IllegalStateException e) {
    // The mediaplayer has not been initialized or has been released
    return true;
  }
}
origin: novoda/no-player

  @Override
  public void onPrepared(PlayerState playerState) {
    noPlayer.play();
  }
};
origin: novoda/no-player

void startPresenting(Uri uri, Options options) {
  listeners.addPreparedListener(playOnPrepared);
  listeners.addStateChangedListener(updatePlayPause);
  listeners.addHeartbeatCallback(updateProgress);
  controllerView.setTogglePlayPauseAction(onTogglePlayPause);
  controllerView.setSeekAction(onSeekPerformed);
  controllerView.setToggleVolumeOnOffAction(onToggleVolume);
  noPlayer.attach(playerView);
  noPlayer.loadVideo(uri, options);
}
origin: novoda/no-player

@Override
public void onBeat(NoPlayer player) {
  if (mediaPlayerIsUnavailable(player)) {
    stopBuffering();
    return;
  }
  long currentPositionInMillis = player.playheadPositionInMillis();
  if (positionNotUpdating(currentPositionInMillis)) {
    beatsPlayed = 0;
    startBuffering();
  } else {
    previousPositionInMillis = currentPositionInMillis;
    beatsPlayed++;
    if (beatsPlayed > FORCED_BUFFERING_BEATS_THRESHOLD) {
      stopBuffering();
    }
  }
}
origin: novoda/no-player

void showAudioSelectionDialog() {
  final AudioTracks audioTracks = noPlayer.getAudioTracks();
  ArrayAdapter<String> adapter = new ArrayAdapter<>(context, R.layout.list_item);
  adapter.addAll(mapAudioTrackToLabel(audioTracks));
  new AlertDialog.Builder(context)
      .setTitle("Select audio track")
      .setAdapter(adapter, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int position) {
          if (position == AUTO_TRACK_POSITION) {
            noPlayer.clearAudioTrackSelection();
          } else {
            PlayerAudioTrack audioTrack = audioTracks.get(position - 1);
            noPlayer.selectAudioTrack(audioTrack);
          }
        }
      })
      .create()
      .show();
}
origin: novoda/no-player

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  NoPlayerLog.setLoggingEnabled(true);
  setContentView(R.layout.activity_main);
  PlayerView playerView = findViewById(R.id.player_view);
  View videoSelectionButton = findViewById(R.id.button_video_selection);
  View audioSelectionButton = findViewById(R.id.button_audio_selection);
  View subtitleSelectionButton = findViewById(R.id.button_subtitle_selection);
  ControllerView controllerView = findViewById(R.id.controller_view);
  videoSelectionButton.setOnClickListener(showVideoSelectionDialog);
  audioSelectionButton.setOnClickListener(showAudioSelectionDialog);
  subtitleSelectionButton.setOnClickListener(showSubtitleSelectionDialog);
  DataPostingModularDrm drmHandler = new DataPostingModularDrm(EXAMPLE_MODULAR_LICENSE_SERVER_PROXY);
  player = new PlayerBuilder()
      .withWidevineModularStreamingDrm(drmHandler)
      .withDowngradedSecureDecoder()
      .build(this);
  demoPresenter = new DemoPresenter(controllerView, player, player.getListeners(), playerView);
  dialogCreator = new DialogCreator(this, player);
  player.getListeners().addDroppedVideoFrames(new NoPlayer.DroppedVideoFramesListener() {
    @Override
    public void onDroppedVideoFrames(int droppedFrames, long elapsedMsSinceLastDroppedFrames) {
      Log.v(getClass().toString(), "dropped frames: " + droppedFrames + " since: " + elapsedMsSinceLastDroppedFrames + "ms");
    }
  });
}
origin: novoda/no-player

@Test
public void givenStatusMightBeNotCorrupted_whenALayoutChangeOccurs_thenForceAlignNativeMediaPlayerStatus() {
  when(player.isPlaying()).thenReturn(true);
  onLayoutChange();
  verify(player, atLeastOnce()).play();
}
origin: novoda/no-player

private boolean statusMightBeCorrupted() {
  return player.isPlaying();
}
origin: novoda/no-player

private void forceAlignNativeMediaPlayerStatus() {
  player.play();
}
origin: novoda/no-player

  @Override
  public void run() {
    if (player.isPlaying()) {
      callback.onBeat(player);
    }
  }
}
origin: novoda/no-player

@Test
public void emitsOnBeat_whenPlayerIsPlaying() {
  given(noPlayer.isPlaying()).willReturn(true);
  Heart.Heartbeat onHeartbeat = new Heart.Heartbeat(heartbeatCallback, noPlayer);
  heart.bind(onHeartbeat);
  heart.startBeatingHeart();
  then(heartbeatCallback).should().onBeat(noPlayer);
}
origin: novoda/no-player

  @Test
  public void emitsOnBeat_whenForcingBeat() {
    given(noPlayer.isPlaying()).willReturn(true);
    Heart.Heartbeat onHeartbeat = new Heart.Heartbeat(heartbeatCallback, noPlayer);
    heart.bind(onHeartbeat);

    heart.forceBeat();

    then(heartbeatCallback).should().onBeat(noPlayer);
  }
}
com.novoda.noplayerNoPlayer

Most used methods

  • isPlaying
  • play
    Plays content of a prepared Player.
  • playheadPositionInMillis
  • attach
    Attaches a given PlayerView to the Player.
  • bufferPercentage
  • clearAudioTrackSelection
    Clears the PlayerAudioTrack selection made in NoPlayer#selectAudioTrack(PlayerAudioTrack).
  • clearVideoTrackSelection
    Clears the PlayerVideoTrack selection made in NoPlayer#selectVideoTrack(PlayerVideoTrack).
  • getAudioTracks
    Retrieves all of the available PlayerAudioTrack of a prepared Player.
  • getListeners
    Retrieves a holder, which allows you to add and remove listeners on the Player.
  • getSubtitleTracks
    Retrieves all of the available PlayerSubtitleTrack of a prepared Player.
  • getVideoTracks
    Retrieves all of the available PlayerVideoTrack of a prepared Player.
  • getVolume
    Return the audio volume, with 0 being silence and 1 being unity gain.
  • getVideoTracks,
  • getVolume,
  • hideSubtitleTrack,
  • loadVideo,
  • mediaDurationInMillis,
  • pause,
  • release,
  • seekTo,
  • selectAudioTrack,
  • selectVideoTrack

Popular in Java

  • Making http requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • addToBackStack (FragmentTransaction)
  • findViewById (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now