Ejemplo n.º 1
0
void
SpeechRecognition::AbortSilently(SpeechEvent* aEvent)
{
  if (mRecognitionService) {
    mRecognitionService->Abort();
  }

  if (mDOMStream) {
    StopRecording();
  }

  ResetAndEnd();
}
Ejemplo n.º 2
0
void
SpeechRecognition::AbortSilently(SpeechEvent* aEvent)
{
  bool stopRecording = StateBetween(STATE_ESTIMATING, STATE_RECOGNIZING);

  if (mRecognitionService) {
    mRecognitionService->Abort();
  }

  if (stopRecording) {
    StopRecording();
  }

  ResetAndEnd();
}
Ejemplo n.º 3
0
void
SpeechRecognition::NotifyFinalResult(SpeechEvent* aEvent)
{
  ResetAndEnd();

  RootedDictionary<SpeechRecognitionEventInit> init(RootingCx());
  init.mBubbles = true;
  init.mCancelable = false;
  // init.mResultIndex = 0;
  init.mResults = aEvent->mRecognitionResultList;
  init.mInterpretation = JS::NullValue();
  // init.mEmma = nullptr;

  RefPtr<SpeechRecognitionEvent> event = SpeechRecognitionEvent::Constructor(
    this, NS_LITERAL_STRING("result"), init);
  event->SetTrusted(true);

  DispatchEvent(*event);
}
Ejemplo n.º 4
0
void
SpeechRecognition::NotifyFinalResult(SpeechEvent* aEvent)
{
  ResetAndEnd();

  nsCOMPtr<nsIDOMEvent> domEvent;
  NS_NewDOMSpeechRecognitionEvent(getter_AddRefs(domEvent), nullptr, nullptr, nullptr);

  nsCOMPtr<nsIDOMSpeechRecognitionEvent> srEvent = do_QueryInterface(domEvent);
  nsRefPtr<SpeechRecognitionResultList> rlist = aEvent->mRecognitionResultList;
  nsCOMPtr<nsISupports> ilist = do_QueryInterface(rlist);
  srEvent->InitSpeechRecognitionEvent(NS_LITERAL_STRING("result"),
                                      true, false, 0, ilist,
                                      NS_LITERAL_STRING("NOT_IMPLEMENTED"),
                                      nullptr);
  domEvent->SetTrusted(true);

  bool defaultActionEnabled;
  this->DispatchEvent(domEvent, &defaultActionEnabled);
}
Ejemplo n.º 5
0
void
SpeechRecognition::NotifyFinalResult(SpeechEvent* aEvent)
{
    ResetAndEnd();

    SpeechRecognitionEventInit init;
    init.mBubbles = true;
    init.mCancelable = false;
    // init.mResultIndex = 0;
    init.mResults = aEvent->mRecognitionResultList;
    init.mInterpretation = NS_LITERAL_STRING("NOT_IMPLEMENTED");
    // init.mEmma = nullptr;

    nsRefPtr<SpeechRecognitionEvent> event =
        SpeechRecognitionEvent::Constructor(this, NS_LITERAL_STRING("result"), init);
    event->SetTrusted(true);

    bool defaultActionEnabled;
    this->DispatchEvent(event, &defaultActionEnabled);
}