congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
C.usToMs
Code IndexAdd Tabnine to your IDE (free)

How to use
usToMs
method
in
com.google.android.exoplayer2.C

Best Java code snippets using com.google.android.exoplayer2.C.usToMs (Showing top 20 results out of 315)

origin: google/ExoPlayer

/**
 * Returns the duration of the window in milliseconds, or {@link C#TIME_UNSET} if unknown.
 */
public long getDurationMs() {
 return C.usToMs(durationUs);
}
origin: google/ExoPlayer

/**
 * Returns the default position relative to the start of the window at which to begin playback,
 * in milliseconds. May be {@link C#TIME_UNSET} if and only if the window was populated with a
 * non-zero default position projection, and if the specified projection cannot be performed
 * whilst remaining within the bounds of the window.
 */
public long getDefaultPositionMs() {
 return C.usToMs(defaultPositionUs);
}
origin: google/ExoPlayer

/**
 * Returns the position of the start of this window relative to the start of the first period
 * belonging to it, in milliseconds.
 */
public long getPositionInFirstPeriodMs() {
 return C.usToMs(positionInFirstPeriodUs);
}
origin: google/ExoPlayer

/**
 * Returns the duration of the period in milliseconds, or {@link C#TIME_UNSET} if unknown.
 */
public long getDurationMs() {
 return C.usToMs(durationUs);
}
origin: google/ExoPlayer

/**
 * Returns the position of the start of this period relative to the start of the window to which
 * it belongs, in milliseconds. May be negative if the start of the period is not within the
 * window.
 */
public long getPositionInWindowMs() {
 return C.usToMs(positionInWindowUs);
}
origin: google/ExoPlayer

private long adjustMediaTime(long mediaTimeUs) {
 long mediaTimeMs = C.usToMs(mediaTimeUs);
 return mediaTimeMs == C.TIME_UNSET ? C.TIME_UNSET : mediaTimeOffsetMs + mediaTimeMs;
}
origin: google/ExoPlayer

@Override
protected long getMediaTimeForChildMediaTime(Void id, long mediaTimeMs) {
 if (mediaTimeMs == C.TIME_UNSET) {
  return C.TIME_UNSET;
 }
 long startMs = C.usToMs(startUs);
 long clippedTimeMs = Math.max(0, mediaTimeMs - startMs);
 if (endUs != C.TIME_END_OF_SOURCE) {
  clippedTimeMs = Math.min(C.usToMs(endUs) - startMs, clippedTimeMs);
 }
 return clippedTimeMs;
}
origin: google/ExoPlayer

@Override
public long getTotalBufferedDuration() {
 return Math.max(0, C.usToMs(playbackInfo.totalBufferedDurationUs));
}
origin: google/ExoPlayer

public boolean isSnapshotValid() {
 if (playlistSnapshot == null) {
  return false;
 }
 long currentTimeMs = SystemClock.elapsedRealtime();
 long snapshotValidityDurationMs = Math.max(30000, C.usToMs(playlistSnapshot.durationUs));
 return playlistSnapshot.hasEndTag
   || playlistSnapshot.playlistType == HlsMediaPlaylist.PLAYLIST_TYPE_EVENT
   || playlistSnapshot.playlistType == HlsMediaPlaylist.PLAYLIST_TYPE_VOD
   || lastSnapshotLoadMs + snapshotValidityDurationMs > currentTimeMs;
}
origin: google/ExoPlayer

/**
 * Advances {@link #firstSampleToOutputIndex} to point to the sync sample before the specified
 * seek time in the current fragment.
 *
 * @param timeUs The seek time, in microseconds.
 */
public void seek(long timeUs) {
 long timeMs = C.usToMs(timeUs);
 int searchIndex = currentSampleIndex;
 while (searchIndex < fragment.sampleCount
   && fragment.getSamplePresentationTime(searchIndex) < timeMs) {
  if (fragment.sampleIsSyncFrameTable[searchIndex]) {
   firstSampleToOutputIndex = searchIndex;
  }
  searchIndex++;
 }
}
origin: google/ExoPlayer

@Override
public Window getWindow(
  int windowIndex, Window window, boolean setTag, long defaultPositionProjectionUs) {
 timeline.getWindow(
   /* windowIndex= */ 0, window, setTag, /* defaultPositionProjectionUs= */ 0);
 window.positionInFirstPeriodUs += startUs;
 window.durationUs = durationUs;
 window.isDynamic = isDynamic;
 if (window.defaultPositionUs != C.TIME_UNSET) {
  window.defaultPositionUs = Math.max(window.defaultPositionUs, startUs);
  window.defaultPositionUs = endUs == C.TIME_UNSET ? window.defaultPositionUs
    : Math.min(window.defaultPositionUs, endUs);
  window.defaultPositionUs -= startUs;
 }
 long startMs = C.usToMs(startUs);
 if (window.presentationStartTimeMs != C.TIME_UNSET) {
  window.presentationStartTimeMs += startMs;
 }
 if (window.windowStartTimeMs != C.TIME_UNSET) {
  window.windowStartTimeMs += startMs;
 }
 return window;
}
origin: google/ExoPlayer

private long periodPositionUsToWindowPositionMs(MediaPeriodId periodId, long positionUs) {
 long positionMs = C.usToMs(positionUs);
 playbackInfo.timeline.getPeriodByUid(periodId.periodUid, period);
 positionMs += period.getPositionInWindowMs();
 return positionMs;
}
origin: google/ExoPlayer

@Override
public long getCurrentPosition() {
 if (shouldMaskPosition()) {
  return maskingWindowPositionMs;
 } else if (playbackInfo.periodId.isAd()) {
  return C.usToMs(playbackInfo.positionUs);
 } else {
  return periodPositionUsToWindowPositionMs(playbackInfo.periodId, playbackInfo.positionUs);
 }
}
origin: google/ExoPlayer

@Override
public long getBufferedPosition() {
 if (isPlayingAd()) {
  return playbackInfo.loadingMediaPeriodId.equals(playbackInfo.periodId)
    ? C.usToMs(playbackInfo.bufferedPositionUs)
    : getDuration();
 }
 return getContentBufferedPosition();
}
origin: google/ExoPlayer

@Override
public long getContentPosition() {
 if (isPlayingAd()) {
  playbackInfo.timeline.getPeriodByUid(playbackInfo.periodId.periodUid, period);
  return period.getPositionInWindowMs() + C.usToMs(playbackInfo.contentPositionUs);
 } else {
  return getCurrentPosition();
 }
}
origin: google/ExoPlayer

@Override
public long getDuration() {
 if (isPlayingAd()) {
  MediaPeriodId periodId = playbackInfo.periodId;
  playbackInfo.timeline.getPeriodByUid(periodId.periodUid, period);
  long adDurationUs = period.getAdDurationUs(periodId.adGroupIndex, periodId.adIndexInAdGroup);
  return C.usToMs(adDurationUs);
 }
 return getContentDuration();
}
origin: google/ExoPlayer

@Override
public void onTimelineChanged(
  Timeline timeline, @Nullable Object manifest, @Player.TimelineChangeReason int reason) {
 if (reason == Player.TIMELINE_CHANGE_REASON_RESET) {
  // The player is being reset and this source will be released.
  return;
 }
 Assertions.checkArgument(timeline.getPeriodCount() == 1);
 this.timeline = timeline;
 long contentDurationUs = timeline.getPeriod(0, period).durationUs;
 contentDurationMs = C.usToMs(contentDurationUs);
 if (contentDurationUs != C.TIME_UNSET) {
  adPlaybackState = adPlaybackState.withContentDurationUs(contentDurationUs);
 }
 updateImaStateForPlayerState();
}
origin: google/ExoPlayer

 @Override
 protected FakeMediaPeriod createFakeMediaPeriod(
   MediaPeriodId id,
   TrackGroupArray trackGroupArray,
   Allocator allocator,
   EventDispatcher eventDispatcher,
   @Nullable TransferListener transferListener) {
  eventDispatcher.downstreamFormatChanged(
    new MediaLoadData(
      C.DATA_TYPE_MEDIA,
      C.TRACK_TYPE_UNKNOWN,
      /* trackFormat= */ null,
      C.SELECTION_REASON_UNKNOWN,
      /* trackSelectionData= */ null,
      C.usToMs(eventStartUs),
      C.usToMs(eventEndUs)));
  return super.createFakeMediaPeriod(
    id, trackGroupArray, allocator, eventDispatcher, transferListener);
 }
};
origin: google/ExoPlayer

@Override
public SeekPoints getSeekPoints(long timeUs) {
 timeUs = Util.constrainValue(timeUs, 0, durationUs);
 Pair<Long, Long> timeMsAndPosition =
   linearlyInterpolate(C.usToMs(timeUs), referenceTimesMs, referencePositions);
 timeUs = C.msToUs(timeMsAndPosition.first);
 long position = timeMsAndPosition.second;
 return new SeekPoints(new SeekPoint(timeUs, position));
}
origin: google/ExoPlayer

@Override
public long getDuration() {
 if (timeline.isEmpty()) {
  return C.INDEX_UNSET;
 }
 if (isPlayingAd()) {
  long adDurationUs =
    timeline.getPeriod(0, period).getAdDurationUs(adGroupIndex, adIndexInAdGroup);
  return C.usToMs(adDurationUs);
 } else {
  return timeline.getWindow(getCurrentWindowIndex(), window).getDurationMs();
 }
}
com.google.android.exoplayer2CusToMs

Javadoc

Converts a time in microseconds to the corresponding time in milliseconds, preserving #TIME_UNSET and #TIME_END_OF_SOURCE values.

Popular methods of C

  • msToUs
  • generateAudioSessionIdV21
    Returns a newly generated audio session identifier, or AudioManager#ERROR if an error occurred in wh

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • onCreateOptionsMenu (Activity)
  • startActivity (Activity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now