هم برنامه و هم دستگاه باید در یک حساب توسعه دهنده ثبت شده باشند تا بتوانید اشکال زدایی را انجام دهید.
برنامه فرستنده خود را راه اندازی کنید و به دستگاه Google Cast ارسال کنید تا برنامه Web Receiver برای اشکال زدایی بارگیری شود. مطمئن شوید که دستگاههای فرستنده و گیرنده وب شما به یک شبکه متصل هستند.
دو راه برای اتصال به دستگاه برای رفع اشکال از راه دور وجود دارد:
بازرس کروم
در مرورگر کروم، موارد زیر را در قسمت آدرس وارد کنید تا به بازرس کروم بروید:
chrome://inspect
فهرستی از دستگاههای دارای قابلیت Cast در آن شبکه ظاهر میشود.
دستگاهی را برای برنامه گیرنده وب که میخواهید اشکالزدایی کنید، با کلیک کردن روی پیوند Inspect آن انتخاب کنید.
یک پنجره بازرس باید باز شود، که به شما امکان می دهد برنامه Web Receiver را از راه دور اشکال زدایی کنید.
مستقیماً به درگاه 9222 دستگاه
در مرورگر کروم، موارد زیر را در قسمت آدرس وارد کنید تا مستقیماً به دستگاهی که در حال رفع اشکال هستید بروید. اگر دستگاههای زیادی در شبکه خود دارید، ممکن است سریعتر از Chrome Inspector باشد:
<deviceIPaddress>:9222
آدرس IP دستگاه را می توان با انتخاب دستگاه در برنامه Google Home، رفتن به تنظیمات و نگاه کردن به بخش اطلاعات پیدا کرد.
با کلیک روی پیوند Remote Debugging جلسه ای را که می خواهید اشکال زدایی کنید، انتخاب کنید.
اگر Chrome Remote Debugger پر نشد، نماد سمت چپ نوار آدرس را انتخاب کنید و site settings انتخاب کنید. به پایین تنظیمات بروید و تنظیم Insecure content به Allow تغییر دهید.
در کنسول Chrome Remote Debugger، با وارد کردن موارد زیر، گزارش اشکال زدایی را فعال کنید:
دستکاری کامل DOM و همچنین جاوا اسکریپت کامل کروم REPL ( کنسول ) پشتیبانی میشود، که به شما امکان میدهد با برنامه گیرنده وب در حال اجرا دستکاری کنید.
هنگامی که گیرنده وب شما از بین می رود (چرخه عمر به پایان می رسد)، اشکال زدا با یک پیام هشدار در بالای صفحه غیرفعال می شود. در این مرحله دیگر نمی توانید با دیباگر تعامل داشته باشید. برای راه اندازی مجدد اشکال زدایی، باید برنامه Web Receiver را مجددا راه اندازی کنید و سپس بازرس را دوباره بارگیری کنید.
نقاط شکست
با استفاده از debugger; در کد گیرنده وب شما
ذخیره محلی
window.location.reload(true); برای انجام یک بارگذاری مجدد اجباری که حافظه پنهان برنامه گیرنده وب را پاک می کند.
حفظ لاگ بین جلسات
میتوانید گزارشها را بین جلسات با کلیک کردن روی نماد چرخدنده در اشکالزدا و علامت زدن کادر کنار «حفظ گزارش هنگام پیمایش» حفظ کنید.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eUse the Chrome Remote Debugger to debug your Cast Web Receiver application by inspecting it through \u003ccode\u003echrome://inspect\u003c/code\u003e or directly accessing the device's 9222 port.\u003c/p\u003e\n"],["\u003cp\u003eTo enable debugging, register your application and Cast device on the Google Cast SDK Developer Console, ensuring both are linked to the same developer account.\u003c/p\u003e\n"],["\u003cp\u003eInitiate a cast session from your sender app to the target Cast device to load the Web Receiver and allow the debugger to connect.\u003c/p\u003e\n"],["\u003cp\u003eLeverage the Chrome Remote Debugger's console for logging, DOM manipulation, and utilizing the JavaScript REPL for interacting with the running Web Receiver app.\u003c/p\u003e\n"],["\u003cp\u003eRemember to disable debug logging in production environments and avoid logging sensitive information.\u003c/p\u003e\n"]]],["To debug a Cast app using Chrome Remote Debugger, first register your app and device on the Google Cast SDK Developer Console. Then, start your sender app and cast to the device to load the Web Receiver app. Connect to the device via `chrome://inspect` or directly using `\u003cdevice IP address\u003e:9222`. Select the Web Receiver session to debug and enable debug logging with `cast.framework.CastReceiverContext.getInstance().setLoggerLevel(cast.framework.LoggerLevel.DEBUG);`. Use `debugger;` for breakpoints and `window.location.reload(true);` to flush the cache. Preserve logs between sessions in the settings.\n"],null,["# Chrome Remote Debugger\n\nUse the Chrome Remote Debugger to debug a Cast application.\n| **Caution:** Leaving the Remote Debugger attached for prolonged periods can exhaust resources on the Web Receiver and result in a failure.\n| **Note:** Second and third generation Chromecast devices running firmware version 1.49 may not be able to debug Cast sessions using the Chrome Remote Debugger. If you are not able to see your app in chrome://inspect, please try another Cast device or use the [Cast Debug Logger](/cast/docs/debugging/cast_debug_logger).\n\nLaunch Chrome Remote Debugger for a particular Google Cast device as follows:\n\nTo debug Cast apps on an Android TV device, see\n[Android TV: Debugging](/cast/docs/android_tv_receiver/debugging#debugging).\n\nTo debug a Web Receiver app on Google Cast devices, do the following:\n\n1. [Register](/cast/docs/registration) your application and Google Cast device\n on the [Google Cast SDK Developer Console](https://cast.google.com/publish).\n\n | **Note:** The device serial number can be found by navigating to the Google Cast SDK Developer Console and casting the tab to your device.\n\n \u003cbr /\u003e\n\n Both the application and device must be registered to the same developer\n account in order for you to perform debugging.\n2. Start your *sender* app and cast to the Google Cast device\n to load the Web Receiver app for debugging. Make sure your sender and Web\n Receiver devices are connected to the same network.\n\n | **Important:** Debugging will not work if the this step is skipped.\n\n \u003cbr /\u003e\n\n3. There are two ways to connect to your device for remote debugging:\n\n 1. Chrome Inspector\n\n 1. In the Chrome browser, enter the following in the address\n field to go to the Chrome inspector:\n\n chrome://inspect\n\n A list of Cast-enabled devices on that network appears.\n 2. Select the device for the Web Receiver app you want to debug by\n clicking its `Inspect` link.\n\n An inspector window should open, enabling you to remotely debug the\n Web Receiver app.\n 2. Directly to the device's 9222 port\n\n 1. In the Chrome browser, enter the following in the address field to\n go to the device you are debugging directly. This may be faster\n than the Chrome Inspector if you have many devices on your network:\n\n \u003cdevice IP address\u003e:9222\n\n The device IP address can be found by selecting the device in the\n Google Home app, going to settings, and looking under the\n Information section.\n 2. Select the session you would like to debug by clicking its\n `Remote Debugging` link.\n\n 3. If the Chrome Remote Debugger does not populate, select the\n icon to the left of the address bar and select `site settings`.\n Scroll to the bottom of the settings and change the setting for\n `Insecure content` to `Allow`.\n\n4. In the Chrome Remote Debugger console, enable debug logging, by entering the\n following:\n\n ```\n cast.framework.CastReceiverContext.getInstance().setLoggerLevel(cast.framework.LoggerLevel.DEBUG);\n ```\n\n \u003cbr /\u003e\n\n | **Warning:** Always disable debug logging for production, and never log any personally identifiable information.\n\n Full DOM manipulation is supported as well as the full Chrome JavaScript\n REPL ([console](/chrome-developer-tools/docs/console)), which will allow you\n to tinker with the running Web Receiver app.\n\n When your Web Receiver is torn down (lifecycle ended), the debugger will\n become inactive with a warning message along the top. At this point you can\n no longer interact with the debugger. To restart debugging, you must restart\n the Web Receiver app and then reload the inspector.\n\nBreakpoints\n-----------\n\nYou can add manual breakpoints to your code by using `debugger;` within your\nWeb Receiver code.\n\nLocal caching\n-------------\n\nUse `window.location.reload(true);` to perform a forced reload that flushes the\ncache of the Web Receiver application.\n\nPreserving logs between sessions\n--------------------------------\n\nYou can preserve the logs between sessions by clicking the gear icon within the\ndebugger and checking the box next to \"Preserve log upon navigation\".\n| **Note:** If you're having problems playing streams on a Cast device, it may be an issue with CORS. Use a publicly available CORS proxy server to test your streams. (Be aware that third-party software referenced here is not controlled by Google. Google cannot guarantee that third-party software will operate as intended. Proceed with caution.)"]]