I'm trying to create an Text To Speech service which uses Google API Text-To-Speech. Hee is my code:
// Setup Google Client
require_once '../../plugins/php/google-api-php-client-2.4.1/vendor/autoload.php';
$client = new Google_Client();
$client->setAuthConfig('../../plugins/php/google-api-php-client-2.4.1/credentials.json');
$client->addScope(Google_Service_Texttospeech::CLOUD_PLATFORM);
$service = new Google_Service_Texttospeech($client);
// Setup Request
$input = new Google_Service_Texttospeech_SynthesisInput();
$input->setText('Japan\'s national soccer team won against Colombia!');
$voice = new Google_Service_Texttospeech_VoiceSelectionParams();
$voice->setLanguageCode('en-US');
$audioConfig = new Google_Service_Texttospeech_AudioConfig();
$audioConfig->setAudioEncoding(Google_Service_Texttospeech_AudioEncoding::MP3);
Everything works except the last line which is giving the error:
Fatal error: Uncaught Error: Class 'AudioEncoding' not found in /home/******/public_html/services/remotes/post/convert-text-to-speech.php:28 Stack trace: #0 {main} thrown in /home/******/public_html/services/remotes/post/convert-text-to-speech.php on line 28
Any help on this?