// ****************************************************************************
// Method: VisualCueList::SetFrom
//
// Purpose: Build the VisualCueList AttributeGroupVector directly from
//          a vector of VisualCueInfo pointers
//
// ****************************************************************************
void
VisualCueList::SetFrom(const std::vector<const VisualCueInfo*>& cueVec)
{
    ClearCues();
    for (size_t i = 0; i < cueVec.size(); i++)
        AddCues(*(cueVec[i]));
}
Esempio n. 2
0
already_AddRefed<TextTrack> TextTrackManager::AddTextTrack(
    TextTrackKind aKind, const nsAString& aLabel, const nsAString& aLanguage,
    TextTrackMode aMode, TextTrackReadyState aReadyState,
    TextTrackSource aTextTrackSource) {
  if (!mMediaElement || !mTextTracks) {
    return nullptr;
  }
  RefPtr<TextTrack> track = mTextTracks->AddTextTrack(
      aKind, aLabel, aLanguage, aMode, aReadyState, aTextTrackSource,
      CompareTextTracks(mMediaElement));
  WEBVTT_LOG("AddTextTrack %p kind %" PRIu32 " Label %s Language %s",
             track.get(), static_cast<uint32_t>(aKind), NS_ConvertUTF16toUTF8(aLabel).get(),
             NS_ConvertUTF16toUTF8(aLanguage).get());
  AddCues(track);
  ReportTelemetryForTrack(track);

  if (aTextTrackSource == TextTrackSource::Track) {
    RefPtr<nsIRunnable> task = NewRunnableMethod(
        "dom::TextTrackManager::HonorUserPreferencesForTrackSelection", this,
        &TextTrackManager::HonorUserPreferencesForTrackSelection);
    nsContentUtils::RunInStableState(task.forget());
  }

  return track.forget();
}
Esempio n. 3
0
already_AddRefed<TextTrack>
TextTrackManager::AddTextTrack(TextTrackKind aKind, const nsAString& aLabel,
                               const nsAString& aLanguage,
                               TextTrackMode aMode,
                               TextTrackReadyState aReadyState,
                               TextTrackSource aTextTrackSource)
{
  if (!mMediaElement || !mTextTracks) {
    return nullptr;
  }
  WEBVTT_LOG("%p AddTextTrack",this);
  WEBVTT_LOGV("AddTextTrack kind %d Label %s Language %s",aKind,
    NS_ConvertUTF16toUTF8(aLabel).get(), NS_ConvertUTF16toUTF8(aLanguage).get());
  RefPtr<TextTrack> track =
    mTextTracks->AddTextTrack(aKind, aLabel, aLanguage, aMode, aReadyState,
                              aTextTrackSource, CompareTextTracks(mMediaElement));
  AddCues(track);
  ReportTelemetryForTrack(track);

  if (aTextTrackSource == TextTrackSource::Track) {
    NS_DispatchToMainThread(NewRunnableMethod(this, &TextTrackManager::HonorUserPreferencesForTrackSelection));
  }

  return track.forget();
}
void
TextTrackManager::AddTextTrack(TextTrack* aTextTrack)
{
  if (!mMediaElement) {
    return;
  }
  mTextTracks->AddTextTrack(aTextTrack, CompareTextTracks(mMediaElement));
  AddCues(aTextTrack);
}
Esempio n. 5
0
void
TextTrackManager::AddTextTrack(TextTrack* aTextTrack)
{
  if (!mMediaElement) {
    return;
  }
  mTextTracks->AddTextTrack(aTextTrack, CompareTextTracks(mMediaElement));
  AddCues(aTextTrack);
  if (aTextTrack->GetTextTrackSource() == Track) {
    HonorUserPreferencesForTrackSelection();
  }
}
Esempio n. 6
0
void
TextTrackManager::AddTextTrack(TextTrack* aTextTrack)
{
  if (!mMediaElement || !mTextTracks) {
    return;
  }
  mTextTracks->AddTextTrack(aTextTrack, CompareTextTracks(mMediaElement));
  AddCues(aTextTrack);
  if (aTextTrack->GetTextTrackSource() == Track) {
    NS_DispatchToMainThread(NewRunnableMethod(this, &TextTrackManager::HonorUserPreferencesForTrackSelection));
  }
}
already_AddRefed<TextTrack>
TextTrackManager::AddTextTrack(TextTrackKind aKind, const nsAString& aLabel,
                               const nsAString& aLanguage,
                               TextTrackSource aTextTrackSource)
{
  if (!mMediaElement) {
    return nullptr;
  }
  nsRefPtr<TextTrack> ttrack =
    mTextTracks->AddTextTrack(aKind, aLabel, aLanguage, aTextTrackSource,
                              CompareTextTracks(mMediaElement));
  ttrack->SetReadyState(HTMLTrackElement::READY_STATE_LOADED);
  AddCues(ttrack);
  return ttrack.forget();
}
Esempio n. 8
0
void TextTrackManager::AddTextTrack(TextTrack* aTextTrack) {
  if (!mMediaElement || !mTextTracks) {
    return;
  }
  WEBVTT_LOG("AddTextTrack TextTrack %p", aTextTrack);
  mTextTracks->AddTextTrack(aTextTrack, CompareTextTracks(mMediaElement));
  AddCues(aTextTrack);
  ReportTelemetryForTrack(aTextTrack);

  if (aTextTrack->GetTextTrackSource() == TextTrackSource::Track) {
    RefPtr<nsIRunnable> task = NewRunnableMethod(
        "dom::TextTrackManager::HonorUserPreferencesForTrackSelection", this,
        &TextTrackManager::HonorUserPreferencesForTrackSelection);
    nsContentUtils::RunInStableState(task.forget());
  }
}
Esempio n. 9
0
already_AddRefed<TextTrack>
TextTrackManager::AddTextTrack(TextTrackKind aKind, const nsAString& aLabel,
                               const nsAString& aLanguage,
                               TextTrackMode aMode,
                               TextTrackReadyState aReadyState,
                               TextTrackSource aTextTrackSource)
{
  if (!mMediaElement) {
    return nullptr;
  }
  nsRefPtr<TextTrack> ttrack =
    mTextTracks->AddTextTrack(aKind, aLabel, aLanguage, aMode, aReadyState,
                              aTextTrackSource, CompareTextTracks(mMediaElement));
  AddCues(ttrack);

  if (aTextTrackSource == Track) {
    HonorUserPreferencesForTrackSelection();
  }

  return ttrack.forget();
}
Esempio n. 10
0
already_AddRefed<TextTrack>
TextTrackManager::AddTextTrack(TextTrackKind aKind, const nsAString& aLabel,
                               const nsAString& aLanguage,
                               TextTrackMode aMode,
                               TextTrackReadyState aReadyState,
                               TextTrackSource aTextTrackSource)
{
  if (!mMediaElement || !mTextTracks) {
    return nullptr;
  }
  RefPtr<TextTrack> ttrack =
    mTextTracks->AddTextTrack(aKind, aLabel, aLanguage, aMode, aReadyState,
                              aTextTrackSource, CompareTextTracks(mMediaElement));
  AddCues(ttrack);

  if (aTextTrackSource == Track) {
    NS_DispatchToMainThread(NewRunnableMethod(this, &TextTrackManager::HonorUserPreferencesForTrackSelection));
  }

  return ttrack.forget();
}