Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
W związku z wycofaniem interfejsu Logowania przez Google w 2026 r. usuniemy pakiet SDK gier w wersji 1. Po lutym 2025 r. nie będzie można publikować w Google Play tytułów, które zostały dopiero zintegrowane z pakietem SDK gier w wersji 1. Zalecamy zamiast tego korzystać z pakietu SDK gier w wersji 2.
Chociaż istniejące tytuły z integracją poprzedniej wersji gry 1 będą działać przez kilka lat, zachęcamy do przejścia na wersję 2 od czerwca 2025 r.
Ten przewodnik dotyczy pakietu SDK usług gier Play w wersji 1. Pakiet SDK Usług gier Play w wersji 2 nie obsługuje nagrywania filmów.
Interfejs API nagrywania filmów umożliwia łatwe dodawanie nagrywania filmów do gry i umożliwia użytkownikom udostępnianie filmów znajomym w YouTube w kilku prostych krokach. Możesz na przykład dodać przycisk na ekranie powtórki bitwy, który po naciśnięciu uruchamia funkcje nagrywania filmów w Grach Play.
Aby zacząć korzystać z interfejsu API nagrywania filmów, gra musi najpierw uzyskać obiekt VideosClient. Aby to zrobić, wywołaj metodę Games.getVideosClient(), przekazując w niej aktywność i GoogleSignInAccount dla bieżącego odtwarzacza. Aby dowiedzieć się, jak odzyskać informacje o koncie gracza, przeczytaj artykuł Logowanie się w Grach na Androida.
Podstawy interfejsu API do nagrywania filmów
Za pomocą interfejsu API do nagrywania filmów możesz zintegrować nagrywanie filmów bezpośrednio w grze.
Funkcja nagrywania wideo obejmuje:
Nakładka nagrywania filmów, która ma 3 przyciski:
Rozpocznij / zatrzymaj nagrywanie
Włączanie i wyłączanie mikrofonu
Włączanie i wyłączanie przedniego aparatu
Przycisk udostępniony przez dewelopera do inicjowania nagrywania lub inny mechanizm nagrywania
Klikalne powiadomienie, które pojawia się na końcu nagrywania i umożliwia graczom przesłanie filmu do YouTube lub wyświetlenie go w aplikacji Zdjęcia (uwaga: nagrane filmy są przechowywane w kategorii ScreenCasts w Zdjęciach).
Uruchom nakładkę nagrywania filmu
Aby rozpocząć nagrywanie filmu w przypadku aktualnie zalogowanego odtwarzacza, wykonaj te czynności:
Jeśli wywołanie się powiedzie, usługi gier Google Play zwrócą obiekt Task, który asynchronicznie wczytuje intencję uruchamiania nakładki nagrywania wideo.
Aby rozpocząć działanie, użyj intencji z poprzedniego kroku.
Wskazówki dotyczące korzystania z danych nagrywania wideo
Interfejs API nagrywania filmów umożliwia zintegrowanie nagrywania filmów bezpośrednio w grze.
Wskazówka
Opis
Ułatwij znalezienie wyzwalacza nagrywania filmów
umieść przycisk nagrywania w widocznym miejscu poza menu głównym;
automatycznie uruchamiać nakładkę z dedykowanej i jasno oznaczonej opcji menu trybu nagrywania;
promowanie korzystania z funkcji w informacjach o aplikacji i w samej grze;
Użyj zrzutu ekranu na stronie aplikacji, który pokazuje nakładkę nagrywania filmu.
promować funkcję nagrywania filmów za pomocą promocji w grze;
Zastanów się nad udostępnianiem nagród w grze za udostępnianie powtórek
Angażuj społeczność graczy dzięki konkursom dotyczącym powtórek
Zachęcaj graczy do nagrywania i udostępniania powtórek rozgrywek dzięki cotygodniowym, miesięcznym lub rocznym konkursom
wyróżniać najlepsze filmy i twórców w grze lub w mediach społecznościowych;
Treść strony i umieszczone na niej fragmenty kodu podlegają licencjom opisanym w Licencji na treści. Java i OpenJDK są znakami towarowymi lub zastrzeżonymi znakami towarowymi należącymi do firmy Oracle lub jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-27 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-07-27 UTC."],[],[],null,["# Video recording in Android games\n\nFollowing the deprecation of the\n[Google Sign-In](https://android-developers.googleblog.com/2024/09/streamlining-android-authentication-credential-manager-replaces-legacy-apis.html)\nAPI, we are removing the games v1 SDK in 2026. After February 2025, you will be unable to publish\ntitles that are newly integrated with games v1 SDK, on Google Play. We recommend that you use the\ngames v2 SDK instead. \n\nWhile existing titles with the previous games v1 integrations continue to function for a\ncouple of years, you are encouraged to\n[migrate to v2](/games/pgs/android/migrate-to-v2)\nstarting June 2025. \n\nThis guide is for using the Play Games Services v1 SDK. Video recording\nis not supported in the Play Games Services v2 SDK.\n\nThe video recording API enables you to easily add video recording to your game\nand let users share their videos with friends on YouTube in a few simple\nsteps. For example, you could add a button off of a battle replay screen that\nwhen pressed would bring up the Play Games video recording experience.\n\nThis guide shows you how to implement video recording in games using the\nGoogle Play Games Services. The APIs can be found in the\n[`com.google.android.gms.games.video`](https://developers.google.com/android/reference/com/google/android/gms/games/video/package-summary) and\n[`com.google.android.gms.games`](https://developers.google.com/android/reference/com/google/android/gms/games/package-summary) packages.\n\nBefore you begin\n----------------\n\nBefore you start to use the video recording API:\n\n- Download and review the\n [code sample](https://github.com/playgameservices/android-basic-samples).\n\n- Familiarize yourself with the recommendations described in the\n [Quality Checklist](/games/pgs/v1/quality).\n\nGet the videos client\n---------------------\n\nTo start using the video recording API, your game must first obtain a\n[`VideosClient`](https://developers.google.com/android/games_v1/reference/com/google/android/gms/games/VideosClient.html) object. You can do this by calling the\n[`Games.getVideosClient()`](https://developers.google.com/android/reference/com/google/android/gms/games/Games.html#getVideosClient(android.app.Activity,%20com.google.android.gms.auth.api.signin.GoogleSignInAccount)) method and passing in the\nactivity and the [`GoogleSignInAccount`](https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInAccount) for the current player. To learn how to\nretrieve the player account information, see\n[Sign-in in Android Games](/games/pgs/v1/android/signin).\n| **Note:** The [`VideosClient`](https://developers.google.com/android/games_v1/reference/com/google/android/gms/games/VideosClient.html) class makes use of the Google Play services [`Task`](https://developers.google.com/android/reference/com/google/android/gms/tasks/Task) class to return results asynchronously. To learn more about using tasks to manage threaded work, see the [Tasks API developer guide](https://developers.google.com/android/guides/tasks).\n\nVideo recording API basics\n--------------------------\n\nYou can use the video recording API to integrate a video recording experience\ndirectly from within your game.\n\nThe video recording experience for users includes the following:\n\n- The video recording overlay, which has three buttons:\n\n 1. Start / stop recording\n 2. Turn on / off mic\n 3. Turn on / off forward facing camera\n\n | **Note:** Clicking the overlay's forward facing camera display brings up the three aforementioned buttons.\n- A developer-provided button to initiate recording, or an alternate recording\n trigger\n\n- A clickable toast that pops up at the end of recording that enables players to\n upload the video to YouTube, or view the video through the Photos app\n (Note: recorded videos are stored under the category `ScreenCasts` in Photos)\n\nLaunch the video recording overlay\n----------------------------------\n\nTo initiate video recording for the currently signed-in player, follow these\nsteps:\n\n1. Call the [`VideosClient.getCaptureOverlayIntent()`](https://developers.google.com/android/reference/com/google/android/gms/games/VideosClient.html#getCaptureOverlayIntent()) method.\n2. If the call is successful, Google Play games services returns a [`Task`](https://developers.google.com/android/reference/com/google/android/gms/tasks/Task) object which asynchronously loads an intent to launch the video recording overlay.\n3. Use the intent from the previous step to start an activity.\n\nHere's an example of how to bring up the video recording overlay: \n\n```transact-sql\nprivate static final int RC_VIDEO_OVERLAY = 9011;\n\npublic void showVideoOverlay(View myview) {\n Games.getVideosClient(this, GoogleSignIn.getLastSignedInAccount(this))\n .getCaptureOverlayIntent()\n .addOnSuccessListener(new OnSuccessListener\u003cIntent\u003e() {\n @Override\n public void onSuccess(Intent intent) {\n startActivityForResult(intent, RC_VIDEO_OVERLAY);\n }\n });\n}\n```\n\nTips for using video recording data\n-----------------------------------\n\nThe video recording API lets you integrate a video recording experience directly\nin your game.\n\n| Tip | Description |\n|----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Make the video recording trigger easily discoverable | - Prominently place a recording button off your main menu - Automatically trigger the overlay from a dedicated and clearly labeled recording mode menu option |\n| Promote use of the feature in your store listing and inside the game | - Use a screenshot in your store listing that displays the video recording overlay - Promote the video recording feature through in-game promotions - Consider providing in-game rewards for replay sharing |\n| Engage your player community with replay competitions | - Encourage players to record and share game replays with weekly / monthly / yearly replay competitions - Recognize top videos and creators in-game or through social media |"]]