исправь ошибку: 2024-06-16 20:07:13.817  5241-5241  System.err              com.example.voicerecognition         W  com.chaquo.python.PyException: AttributeError: module 'yt_dlp' has no attribute 'search'
2024-06-16 20:07:13.818  5241-5241  System.err              com.example.voicerecognition         W  	at <python>.chaquopy_java.Java_com_chaquo_python_PyObject_callAttrThrowsNative(chaquopy_java.pyx:324)
2024-06-16 20:07:13.819  5241-5241  System.err              com.example.voicerecognition         W  	at com.chaquo.python.PyObject.callAttrThrowsNative(Native Method)
2024-06-16 20:07:13.819  5241-5241  System.err              com.example.voicerecognition         W  	at com.chaquo.python.PyObject.callAttrThrows(PyObject.java:232)
2024-06-16 20:07:13.820  5241-5241  System.err              com.example.voicerecognition         W  	at com.chaquo.python.PyObject.callAttr(PyObject.java:221)
2024-06-16 20:07:13.821  5241-5241  System.err              com.example.voicerecognition         W  	at com.example.voicerecognition.MainActivity.searchSong(MainActivity.java:146)
2024-06-16 20:07:13.825  5241-5241  System.err              com.example.voicerecognition         W  	at com.example.voicerecognition.MainActivity.access$100(MainActivity.java:50)
2024-06-16 20:07:13.827  5241-5241  System.err              com.example.voicerecognition         W  	at com.example.voicerecognition.MainActivity$1.onClick(MainActivity.java:134)
2024-06-16 20:07:13.829  5241-5241  System.err              com.example.voicerecognition         W  	at android.view.View.performClick(View.java:7659)
2024-06-16 20:07:13.830  5241-5241  System.err              com.example.voicerecognition         W  	at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1218)
2024-06-16 20:07:13.830  5241-5241  System.err              com.example.voicerecognition         W  	at android.view.View.performClickInternal(View.java:7636)
2024-06-16 20:07:13.833  5241-5241  System.err              com.example.voicerecognition         W  	at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
2024-06-16 20:07:13.834  5241-5241  System.err              com.example.voicerecognition         W  	at android.view.View$PerformClick.run(View.java:30156)
2024-06-16 20:07:13.836  5241-5241  System.err              com.example.voicerecognition         W  	at android.os.Handler.handleCallback(Handler.java:958)
2024-06-16 20:07:13.837  5241-5241  System.err              com.example.voicerecognition         W  	at android.os.Handler.dispatchMessage(Handler.java:99)
2024-06-16 20:07:13.838  5241-5241  System.err              com.example.voicerecognition         W  	at android.os.Looper.loopOnce(Looper.java:205)
2024-06-16 20:07:13.838  5241-5241  System.err              com.example.voicerecognition         W  	at android.os.Looper.loop(Looper.java:294)
2024-06-16 20:07:13.839  5241-5241  System.err              com.example.voicerecognition         W  	at android.app.ActivityThread.main(ActivityThread.java:8177)
2024-06-16 20:07:13.839  5241-5241  System.err              com.example.voicerecognition         W  	at java.lang.reflect.Method.invoke(Native Method)
2024-06-16 20:07:13.842  5241-5241  System.err              com.example.voicerecognition         W  	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
2024-06-16 20:07:13.844  5241-5241  System.err              com.example.voicerecognition         W  	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
в коде:     package com.example.voicerecognition;
    import com.chaquo.python.PyObject;
    import com.chaquo.python.Python;
//    import com.github.ytdl_org.yt_dlp.YTDL;
//    import com.github.ytdl_org.yt_dlp.YTDLRequest;
//    import com.github.ytdl_org.yt_dlp.YTDLResponse;
    import android.app.Activity;
    import android.Manifest;
    import android.content.Intent;
    import android.content.pm.PackageManager;
    import android.media.AudioAttributes;
    import android.media.MediaPlayer;
    import android.os.Bundle;
    import android.speech.RecognizerIntent;
    import android.speech.SpeechRecognizer;
    import android.util.Log;
    import android.view.View;
    import android.widget.Button;
    import android.widget.RelativeLayout;
    import android.widget.TextView;
    import android.widget.Toast;
    import androidx.appcompat.app.AppCompatActivity;
    import androidx.core.app.ActivityCompat;
    import androidx.core.content.ContextCompat;
    import android.speech.RecognitionListener;
    import android.speech.tts.TextToSpeech;
    import com.android.volley.Request;
    import com.android.volley.Response;
    import com.android.volley.VolleyError;
    import com.android.volley.toolbox.JsonObjectRequest;
    import com.android.volley.toolbox.StringRequest;
    import com.android.volley.toolbox.Volley;
    import com.chaquo.python.android.AndroidPlatform;
    import org.json.JSONArray;
    import org.json.JSONException;
    import org.json.JSONObject;
    import com.android.volley.RequestQueue;

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.net.HttpURLConnection;
    import java.net.URL;

    import java.util.ArrayList;
    import java.util.Locale;


    public class MainActivity extends AppCompatActivity implements TextToSpeech.OnInitListener  {

        private SpeechRecognizer speechRecognizer;
        private Intent recognitionIntent;
        private TextView StatusText;
        private TextView RecognizedText;
        private TextView ErrorText;
        private TextView RequestToChatGPT;
        private SpeechRecognitionListener listener;
        private TextToSpeech tts;
        private Button speakButton;
        private Button RecognizeButton;
        private Button SendToChatGPT;
        private String RT = "Начните распознавание";
        private TextView ModelUrlText;
        private Button searchButton;
        private Button playButton;
        private Button pauseButton;
        private Button stopButton;
        private MediaPlayer mediaPlayer;
        private boolean isPlaying = false;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_voice_recognition);
            ModelUrlText = findViewById(R.id.ModelUrlText);
            RecognizedText = findViewById(R.id.RecognizedText);
            ErrorText = findViewById(R.id.ErrorText);
            StatusText = findViewById(R.id.StatusText);
            RequestToChatGPT = findViewById(R.id.RequestToChatGPT);

            RecognizeButton = findViewById(R.id.RecognizeButton);
            speakButton = findViewById(R.id.speakButton);
            SendToChatGPT = findViewById(R.id.SendToChatGPT);
            searchButton = findViewById(R.id.searchButton);
            pauseButton = findViewById(R.id.pauseButton);
            stopButton = findViewById(R.id.stopButton);
            playButton = findViewById(R.id.playButton);
            mediaPlayer = new MediaPlayer();

            listener = new SpeechRecognitionListener(RecognizedText, StatusText, ErrorText);
            speechRecognizer = SpeechRecognizer.createSpeechRecognizer(this);
            speechRecognizer.setRecognitionListener(listener);
            recognitionIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
            recognitionIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
            recognitionIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());

            RecognizeButton.setOnClickListener(v -> checkPermission());
            speakButton.setOnClickListener(v -> speakOut(RT));
            SendToChatGPT.setOnClickListener(v -> sendRequestToHuggingFaceAPI(RT));
    //        SendToChatGPT.setOnClickListener(v -> sendRequestToCustomAPI(RT));
//            SendToChatGPT.setOnClickListener(v -> sendRequestToOpenAI(RT)); // Используйте новый метод здесь


            tts = new TextToSpeech(this, this);


// Получаем LayoutParams кнопки
            RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) searchButton.getLayoutParams();
// Задаем параметры для кнопки
            params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
            params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
// Устанавливаем новые параметры для кнопки
            searchButton.setLayoutParams(params);

//// Размещение кнопок в нужном порядке
//            RelativeLayout.LayoutParams paramsPlay = (RelativeLayout.LayoutParams) playButton.getLayoutParams();
//            paramsPlay.addRule(RelativeLayout.ALIGN_PARENT_RIGHT , R.id.searchButton);
//            playButton.setLayoutParams(paramsPlay);
//
//            RelativeLayout.LayoutParams paramsPause = (RelativeLayout.LayoutParams) pauseButton.getLayoutParams();
//            paramsPause.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, R.id.playButton);
//            pauseButton.setLayoutParams(paramsPause);
//
//            RelativeLayout.LayoutParams paramsStop = (RelativeLayout.LayoutParams) stopButton.getLayoutParams();
//            paramsStop.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, R.id.pauseButton);
//            stopButton.setLayoutParams(paramsStop);

            searchButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    // Handle search button click
                    String query = RT; // Replace RT with the actual value you want to use
                    searchSong(query);
                }
            });

        }
        private void searchSong(String query) {
            // Выполнение поиска видео с использованием библиотеки yt_dlp
            Python.start(new AndroidPlatform(this)); // или Python.start(new AndroidPlatform(getApplicationContext()));
            Python py = Python.getInstance();
            PyObject yt_dlp = py.getModule("yt_dlp");

            try {
                PyObject result = yt_dlp.callAttr("search", query);
                String videoUrl = result.toString();

                // Ваш дальнейший код для воспроизведения видео по полученной ссылке
            } catch (Exception e) {
                e.printStackTrace();
                Toast.makeText(MainActivity.this, "Error searching for song", Toast.LENGTH_SHORT).show();
            }
        }
        private void playMp3(String mp3Url) {
            try {
                if (mediaPlayer == null) {
                    mediaPlayer = new MediaPlayer();
                    mediaPlayer.setAudioAttributes(
                            new AudioAttributes.Builder()
                                    .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
                                    .setUsage(AudioAttributes.USAGE_MEDIA)
                                    .build()
                    );
                    mediaPlayer.setDataSource(mp3Url);
                    mediaPlayer.prepare();
                }

                mediaPlayer.start();

                // Добавьте обработчики для кнопок play, pause и stop
                playButton.setOnClickListener(v -> {
                    if (!mediaPlayer.isPlaying()) {
                        mediaPlayer.start();
                    }
                });

                pauseButton.setOnClickListener(v -> {
                    if (mediaPlayer.isPlaying()) {
                        mediaPlayer.pause();
                    }
                });

                stopButton.setOnClickListener(v -> {
                    if (mediaPlayer.isPlaying()) {
                        mediaPlayer.stop();
                        try {
                            mediaPlayer.prepare();
                        } catch (IOException e) {
                            throw new RuntimeException(e);
                        }
                    }
                });

            } catch (IOException e) {
                e.printStackTrace();
                Toast.makeText(MainActivity.this, "Error playing audio", Toast.LENGTH_SHORT).show();
            }
        }

        private void fetchSong(String id) {
            // Perform the fetch request using the ID
            String fetchUrl = "https://musicapi.x007.workers.dev/fetch?id=" + id;

            RequestQueue queue = Volley.newRequestQueue(this);
            StringRequest stringRequest = new StringRequest(Request.Method.GET, fetchUrl,
                    new Response.Listener<String>() {
                        @Override
                        public void onResponse(String response) {
                            RecognizedText.setText(response);
                            // Play the response
                            playResponse();
                        }
                    },
                    new Response.ErrorListener() {
                        @Override
                        public void onErrorResponse(VolleyError error) {
                            Toast.makeText(MainActivity.this, "Error fetching song", Toast.LENGTH_SHORT).show();
                        }
                    });

            queue.add(stringRequest);
        }
        private void sendRequestToOpenAI(String text) {
            Thread thread = new Thread(() -> {
                try {
//                    URL url = new URL("https://4thespam.pythonanywhere.com/");
                    URL url = new URL("https://api.openai.com/v1/engines/davinci-codex/completions");
                    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                    conn.setRequestMethod("POST");
                    conn.setRequestProperty("Authorization", "Bearer " + Config.getApiKey()); // Замените на ваш API ключ
                    conn.setRequestProperty("Content-Type", "application/json");
                    conn.setDoOutput(true);
                    JSONObject jsonInput = new JSONObject();
                    jsonInput.put("prompt", text);
                    jsonInput.put("max_tokens", 150);

                    try (OutputStream os = conn.getOutputStream()) {
                        byte[] input = jsonInput.toString().getBytes("utf-8");
                        os.write(input, 0, input.length);
                    }

                    int responseCode = conn.getResponseCode();
                    if (responseCode == HttpURLConnection.HTTP_OK) {
                        BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
                        StringBuilder response = new StringBuilder();
                        String responseLine;
                        while ((responseLine = in.readLine()) != null) {
                            response.append(responseLine.trim());
                        }
                        in.close();

                        JSONObject jsonResponse = new JSONObject(response.toString());
                        String generatedText = jsonResponse.getJSONArray("choices").getJSONObject(0).getString("text");

                        runOnUiThread(() -> {
                            TextView textView = findViewById(R.id.tvChatGPTResponse);
                            textView.setText(generatedText);
                            speakOut(generatedText);
                        });
                    } else {
                        String errorResponse = "HTTP Error: " + responseCode;
                        if (conn.getErrorStream() != null) {
                            BufferedReader in = new BufferedReader(new InputStreamReader(conn.getErrorStream(), "utf-8"));
                            StringBuilder response = new StringBuilder();
                            String responseLine;
                            while ((responseLine = in.readLine()) != null) {
                                response.append(responseLine.trim());
                            }
                            in.close();
                            errorResponse += " - " + response.toString();
                        }
                        final String finalErrorResponse = errorResponse;
                        runOnUiThread(() -> ErrorText.setText(finalErrorResponse));
                        Log.e("HTTP_ERROR", finalErrorResponse);
                    }
                } catch (Exception e) {
                    final String errorMessage = "Exception: " + e.getMessage();
                    runOnUiThread(() -> ErrorText.setText(errorMessage));
                    Log.e("HTTP_ERROR", errorMessage);
                    e.printStackTrace();
                }
            });
            thread.start();
        }


        private void sendRequestToCustomAPI(String userQuery) {
            Thread thread = new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        URL url = new URL("https://niansuhai-llms2.hf.space/#/chat");
                        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                        conn.setRequestMethod("POST");
                        conn.setRequestProperty("Content-Type", "application/json");
                        conn.setDoOutput(true);

                        // Создаем JSON объект для отправки
                        JSONObject jsonRequest = new JSONObject();
                        JSONArray messages = new JSONArray();
                        JSONObject userMessage = new JSONObject();
                        userMessage.put("role", "user");
                        userMessage.put("content", userQuery);
                        messages.put(userMessage);
                        jsonRequest.put("messages", messages);
                        jsonRequest.put("stream", true);
                        jsonRequest.put("model", "gpt-4-turbo-preview");
                        jsonRequest.put("temperature", 0.5);
                        jsonRequest.put("presence_penalty", 0);
                        jsonRequest.put("frequency_penalty", 0);
                        jsonRequest.put("top_p", 1);

                        String payload = jsonRequest.toString();
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                RequestToChatGPT.setText(payload);
                                ModelUrlText.setText(url.toString());
                            }
                        });

                        OutputStream os = conn.getOutputStream();
                        os.write(payload.getBytes());
                        os.flush();
                        os.close();

                        int responseCode = conn.getResponseCode();
                        Log.d("HTTP_RESPONSE", "Response Code: " + responseCode);
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                ErrorText.setText(String.valueOf(responseCode));
                            }
                        });

                        if (responseCode == HttpURLConnection.HTTP_OK) {
                            BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                            StringBuilder response = new StringBuilder();
                            String inputLine;

                            while ((inputLine = in.readLine()) != null) {
                                response.append(inputLine);
                                response.append("\n");
                            }
                            in.close();

                            Log.d("HTTP_RESPONSE", "Response Body: " + response.toString());

                            String result = response.toString();
                            // Обработка ответа, если он в формате JSON или другом необходимом формате
                            // Например, если ответ приходит в формате JSON с ключом "generated_text"
                            // result = new JSONObject(result).getString("generated_text");

                            String finalResult = result;
                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    TextView textView = findViewById(R.id.tvChatGPTResponse);
                                    textView.setText(finalResult);
                                    speakOut(finalResult);
                                }
                            });
                        } else {
                            Log.e("HTTP_ERROR", "Response Code: " + responseCode);
                        }
                    } catch (Exception e) {
                        Log.e("HTTP_ERROR", "Exception: " + e.getMessage());
                        e.printStackTrace();
                    }
                }
            });
            thread.start();
        }
        private void sendRequestToHuggingFaceAPI(String rt) {
            Thread thread = new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
    //                    URL url = new URL("https://api-inference.huggingface.co/models/yuntian-deng/ChatGPT4"); //нету API 404
    //                    URL url = new URL("https://api-inference.huggingface.co/models/yuntian-deng/ChatGPT"); //нету API 404
    //                    URL url = new URL("https://api-inference.huggingface.co/models/Gertie01/chatgptfree"); //нету API 404
    //                    URL url = new URL("https://api-inference.huggingface.co/models/omkar56/chatgptfree"); //нету API 404
    //                    URL url = new URL("https://api-inference.huggingface.co/models/M4jid007/chatgptfree"); //нету API 404
    //                    URL url = new URL("https://api-inference.huggingface.co/models/KhTalha/chatgptfree"); //нету API 404
    //                    URL url = new URL("https://api-inference.huggingface.co/models/Sattineez/chatgptfree"); //нету API 404
    //                    URL url = new URL("https://api-inference.huggingface.co/models/Jammesopsss/chatgptfreev2bh"); //нету API 404
    //                    URL url = new URL("https://api-inference.huggingface.co/openai-community/openai-gpt"); //возвращает чушь
//                        URL url = new URL("https://api-inference.huggingface.co/models/NiansuhAI/LLMs"); // возвращает чушь
                        URL url = new URL("https://api-inference.huggingface.co/models/yuntian-deng/ChatGPT4");
    //                    URL url = new URL("https://api-inference.huggingface.co/models/EleutherAI/gpt-neo-2.7B"); // возвращает чушь
                        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                        conn.setRequestMethod("POST");
//                        conn.setRequestProperty("Authorization", "Bearer " + "<TRUFFLEHOG_REDACTED_HUGGINGFACE>");
                        conn.setRequestProperty("Content-Type", "application/json");
                        conn.setDoOutput(true);
                        String payload = "{\"inputs\": \"" + rt + "\"}";
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                RequestToChatGPT.setText(payload);
                                ModelUrlText.setText(url.toString());
                            }
                        });
                        OutputStream os = conn.getOutputStream();
                        os.write(payload.getBytes());
                        os.flush();
                        os.close();

                        int responseCode = conn.getResponseCode();
                        Log.d("HTTP_RESPONSE", "Response Code: " + responseCode); // Логирование кода ответа
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                ErrorText.setText(String.valueOf(responseCode));
                            }
                        });

                        if (responseCode == HttpURLConnection.HTTP_OK) {
                            BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                            StringBuilder response = new StringBuilder();
                            String inputLine;

                            while ((inputLine = in.readLine()) != null) {
                                response.append(inputLine);
                                response.append("\n");
                            }
                            in.close();


                            // Логирование полученного ответа
                            Log.d("HTTP_RESPONSE", "Response Body: " + response.toString());

                            // Обновляем TextView в главном потоке
                            String result = response.toString();
                            result = result.replace("[{\"generated_text\":\"", "");
                            result = result.replace(RT, ""); // Добавьте эту строку
                            result = result.replace("?", ""); // Добавьте эту строку
                            result = result.replace("\n\n", ""); // Добавьте эту строку
                            String finalResult = result;
                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    TextView textView = findViewById(R.id.tvChatGPTResponse);
                                    textView.setText(finalResult);
                                    speakOut(finalResult);
                                }
                            });
                        } else {
                            Log.e("HTTP_ERROR", "Response Code: " + responseCode);
                        }
                    } catch (Exception e) {
                        Log.e("HTTP_ERROR", "Exception: " + e.getMessage());
                        e.printStackTrace();                }
                }
            });
            thread.start();
        }

        private void checkPermission() {
            if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
                ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.RECORD_AUDIO}, MY_PERMISSIONS_RECORD_AUDIO);
            } else {
                startVoiceRecognition();
            }
        }

        private void startVoiceRecognition() {
            speechRecognizer.startListening(recognitionIntent);
        }

        @Override
        public void onInit(int status) {
            if (status == TextToSpeech.SUCCESS) {
                int result = tts.setLanguage(Locale.getDefault());
    //            int result = tts.setLanguage(new Locale("ru"));

                if (result == TextToSpeech.LANG_MISSING_DATA ||
                        result == TextToSpeech.LANG_NOT_SUPPORTED) {
                    Log.e("TTS", "This Language is not supported");
                } else {
                    speakButton.setEnabled(true);
                }
            } else {
                Log.e("TTS", "Initialization Failed!");
            }
        }

        private void speakOut(String text) {
            tts.speak(text, TextToSpeech.QUEUE_FLUSH, null, null);
        }

        @Override
        public void onDestroy() {
            if (tts != null) {
                tts.stop();
                tts.shutdown();
            }
            super.onDestroy();
        }

        public class SpeechRecognitionListener implements RecognitionListener {

            private TextView StatusText;
            private TextView RecognizedText;
            private TextView ErrorText;

            public SpeechRecognitionListener(TextView RecognizedText, TextView StatusText , TextView errorText) {
                this.StatusText = StatusText;
                this.RecognizedText = RecognizedText;
                this.ErrorText = errorText;
            }

            @Override
            public void onReadyForSpeech(Bundle params) {
                StatusText.setText("Готов");
            }

            @Override
            public void onBeginningOfSpeech() {
                StatusText.setText("Слушаю внимательно");
            }

            @Override
            public void onRmsChanged(float rmsdB) {
            }

            @Override
            public void onBufferReceived(byte[] buffer) {
                StatusText.setText("Получен буфер");
            }

            @Override
            public void onEndOfSpeech() {
                StatusText.setText("Конец речи");
            }

            @Override
            public void onError(int error) {
                ErrorText.setText("Ошибка " + error);
                RT = "Rammstein Ich WIll";
                RecognizedText.setText(RT);
    //            StatusText.setText(Config.getApiKey());
            }

            @Override
            public void onResults(Bundle results) {
                ArrayList<String> matches = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
                RT = "Пока ничего не распознано";
                RecognizedText.setText(RT);
                StatusText.setText("Распознаем");
                if (matches != null && !matches.isEmpty() && matches.get(0) != null) {
                    RT = matches.get(0);
                    RecognizedText.setText(RT);
                    speakOut(RT);
                    sendRequestToOpenAI(RT); // Используйте новый метод здесь
                }
            }

            @Override
            public void onPartialResults(Bundle partialResults) {
                StatusText.setText("Частичные результаты");
            }

            @Override
            public void onEvent(int eventType, Bundle params) {
                StatusText.setText("Событие");
            }
        }
        private void playResponse() {
            if (mediaPlayer != null && !mediaPlayer.isPlaying()) {
                mediaPlayer.start();
                isPlaying = true;
            }
        }

        private void pauseResponse() {
            if (mediaPlayer != null && mediaPlayer.isPlaying()) {
                mediaPlayer.pause();
                isPlaying = false;
            }
        }

        private void stopResponse() {
            if (mediaPlayer != null && mediaPlayer.isPlaying()) {
                mediaPlayer.stop();
                mediaPlayer.reset();
                isPlaying = false;
            }
        }
        private static final int MY_PERMISSIONS_RECORD_AUDIO = 1;
    }