2022-03-25 03:05:20 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
|
|
|
import Service from '/imports/ui/components/audio/captions/service';
|
|
|
|
import Button from './component';
|
2022-08-24 23:40:03 +08:00
|
|
|
import SpeechService from '/imports/ui/components/audio/captions/speech/service';
|
|
|
|
import AudioService from '/imports/ui/components/audio/service';
|
2022-03-25 03:05:20 +08:00
|
|
|
|
|
|
|
const Container = (props) => <Button {...props} />;
|
|
|
|
|
2022-08-24 23:40:03 +08:00
|
|
|
export default withTracker(() => {
|
|
|
|
const isRTL = document.documentElement.getAttribute('dir') === 'rtl';
|
|
|
|
const availableVoices = SpeechService.getSpeechVoices();
|
|
|
|
const currentSpeechLocale = SpeechService.getSpeechLocale();
|
|
|
|
const isSupported = availableVoices.length > 0;
|
|
|
|
const isVoiceUser = AudioService.isVoiceUser();
|
|
|
|
return {
|
|
|
|
isRTL,
|
|
|
|
enabled: Service.hasAudioCaptions(),
|
|
|
|
active: Service.getAudioCaptions(),
|
|
|
|
currentSpeechLocale,
|
|
|
|
availableVoices,
|
|
|
|
isSupported,
|
|
|
|
isVoiceUser,
|
|
|
|
};
|
|
|
|
})(Container);
|