[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003e\u003ccode\u003eCastReceiverOptions\u003c/code\u003e allows developers to customize the behavior of their Cast receiver application.\u003c/p\u003e\n"],["\u003cp\u003eIt offers options to configure playback, networking, custom namespaces, UI elements, and supported media commands.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can define custom behavior by setting properties like \u003ccode\u003eplaybackConfig\u003c/code\u003e, \u003ccode\u003esupportedCommands\u003c/code\u003e, \u003ccode\u003euiConfig\u003c/code\u003e, and more.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eCastReceiverOptions\u003c/code\u003e object is used when initializing the Cast receiver application framework.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can utilize this object to specify Shaka player versions and control the loading of media players like MPL and Shaka.\u003c/p\u003e\n"]]],["The `CastReceiverOptions` class configures the Cast receiver context. Key actions include setting `adBreakPreloadTime`, defining `customNamespaces`, and managing `disableIdleTimeout`. It configures media playback with properties like `mediaElement`, `playbackConfig`, `preferredPlaybackRate`, and track language. Options manage player behavior, like loading MPL or Shaka (`skipMplLoad`, `skipShakaLoad`). Additional settings include `maxInactivity`, `supportedCommands`, and `uiConfig` for customization, `versionCode` for internal tracking, and enabling specific feature like `useShakaForHls`.\n"],null,["# Class: CastReceiverOptions\n\ncast.[framework](/cast/docs/reference/web_receiver/cast.framework).CastReceiverOptions\n======================================================================================\n\nclass static\n\nCast receiver context options.\nAll properties are optional.\n\nConstructor\n-----------\n\n### CastReceiverOptions\n\nnew\nCastReceiverOptions()\n\nProperties\n----------\n\n### adBreakPreloadTime\n\n(number or undefined)\n\nHow far in advance we should preload the contents of an individual ad\nbreak, in seconds. This allows you to avoid preloading an ad break too\nfar in advance, and thus confuse your ad metrics.\nIf not provided, a default of 5 seconds is used.\n\n### customNamespaces\n\nnon-null Object with non-null [cast.framework.system.MessageType](/cast/docs/reference/web_receiver/cast.framework.system#.MessageType) properties\n\nMap of custom message namespaces and their types. Custom\nmessage namespaces must be initialized before the application\nstarts, so they must be provided in the receiver options.\n(The default message type is JSON if not provided here).\n\n### disableIdleTimeout\n\n(boolean or undefined)\n\nIf true, prevents the receiver from being closed when it becomes idle\nafter active playback stops. This property should be used only for\nnon-media apps.\n\n### enforceSupportedCommands\n\nconstant\n\nboolean\n\nIf true, any media command that is not in the supportedCommands map will\ngenerate an error. The cast.framework.messages.ErrorReason will be set\nto NOT_SUPPORTED. Default value is false, which allows media commands\nto be executed without checking the map.\n\n### localSenderId\n\n(string or undefined)\n\nSender ID used for local requests. Default value is 'local'.\n\n### maxInactivity\n\n(number or undefined)\n\nMaximum time in seconds before closing an idle\nsender connection. Setting this value enables a heartbeat message to keep\nthe connection alive. Used to detect unresponsive senders faster than\ntypical TCP timeouts. The minimum value is 5 seconds; no upper\nbound is enforced, but it typically takes minutes before platform TCP\ntimeouts come into play. Default value is 10 seconds.\n\n### mediaElement\n\n(non-null HTMLMediaElement or undefined)\n\nMedia element to play content with. Default behavior is to use\nthe first media element found in the page.\n\n### playbackConfig\n\n(non-null [cast.framework.PlaybackConfig](/cast/docs/reference/web_receiver/cast.framework.PlaybackConfig) or undefined)\n\nA playback configuration with custom parameters.\n\n### playWatchedBreak\n\n(boolean or undefined)\n\nIf true, a client-stitched break will play even if it was already\nwatched.\n\n### preferredPlaybackRate\n\n(number or undefined)\n\nThe playback rate to use if unspecified in the load request. Allowable\nrange is 0.5 to 2, with 1 being normal speed.\n\n### preferredTextLanguage\n\n(string or undefined)\n\nLanguage to use for the text track if the load request does not\nspecify an active track.\n\n### queue\n\n(non-null [cast.framework.QueueBase](/cast/docs/reference/web_receiver/cast.framework.QueueBase) or undefined)\n\nCustom queue implementation.\n\n### shakaVariant\n\n(non-null [cast.framework.ShakaVariant](/cast/docs/reference/web_receiver/cast.framework#.ShakaVariant) or undefined)\n\nWhich build of Shaka Player should be loaded. Set to\n`cast.framework.ShakaVariant.DEBUG` to load a debug build.\n\n### shakaVersion\n\n(string or undefined)\n\nShaka version in the MAJOR.MINOR.PATCH format, for example \"4.9.2\" (the\ncurrent default).\n\nSupported versions are \\\u003e=4.9.2 \\\u003c5.0.0.\nDeprecated but still compatible versions are \\\u003e=2.5.6 \\\u003c4.9.2.\n\nNOTE: Shaka Player versions older than the default are not recommended,\nas many bugs have been fixed in the latest versions. Newer versions may\nbe specified here to opt-in to additional fixes or features that are not\nyet available by default. However, please be aware that future releases\nof the Web Receiver SDK may change the range of supported versions and\nforce the use of a version other than what you specify here. This flag\nshould be used only as a temporary measure, and under guidance from the\nCast support team. (https://developers.google.com/cast/support) Use at\nyour own risk.\n\n### skipMplLoad\n\n(boolean or undefined)\n\nIf true, prevents the receiver from loading the MPL player.\n\n### skipPlayersLoad\n\n(boolean or undefined)\n\nIf true, prevents the receiver from loading the MPL or Shaka player\nlibraries. Equivalent to setting both skipMplLoad and skipShakaLoad\nto true.\n\n### skipShakaLoad\n\n(boolean or undefined)\n\nIf true, prevents the receiver from loading the Shaka player.\n\n### statusText\n\n(string or undefined)\n\nText that represents the application status. It should meet\ninternationalization rules, as it may be displayed by the sender\napplication.\n\n### supportedCommands\n\n(number or undefined)\n\nA bitmask of media commands\nsupported by the application. LOAD, PLAY, STOP, GET_STATUS must always\nbe supported. If this value is not provided, then PAUSE, SEEK,\nSTREAM_VOLUME, STREAM_MUTE, EDIT_TRACKS, and PLAYBACK_RATE are also\nassumed to be supported.\n\nSee also\n: [cast.framework.messages.Command](/cast/docs/reference/web_receiver/cast.framework.messages#.Command)\n\n### uiConfig\n\n(non-null [cast.framework.ui.UiConfig](/cast/docs/reference/web_receiver/cast.framework.ui.UiConfig) or undefined)\n\nUI Configuration.\n\n### useLegacyDashSupport\n\n(boolean or undefined)\n\nIf `true`, use MPL for DASH content.\n\n### useShakaForHls\n\n(boolean or undefined)\n\nIf `true`, use Shaka Player for HLS content. Defaults to `false`.\n\nNOTE: Shaka Player is not the default for HLS content because there are\nstill missing features, and because we want to ensure that it is\nperformant and broadly compatible with HLS receivers before making it the\ndefault. If you opt into Shaka Player for HLS before the official\nlaunch, we would ask that you please report any issues you encounter.\n(https://developers.google.com/cast/support) Before the full launch\nof Shaka Player for HLS, we make no guarantees about Shaka Player\ncompatibility for HLS, and we may advise you to revert this flag to its\ndefault setting if you encounter non-trivial issues.\n\n### versionCode\n\n(number or undefined)\n\nAn integer used as an internal version number to represent your receiver\nversion. This number is used only to distinguish between receiver\nreleases when collecting metrics. It should be incremented with each\nrelease and remain bound to that release in the event of a rollback."]]