Trình liên kết dữ liệu của người chơi. Thao tác này sẽ liên kết một đối tượng dữ liệu người chơi với trạng thái người chơi.
Dữ liệu của người chơi được cập nhật để phản ánh chính xác trạng thái hiện tại của người chơi mà không cần kích hoạt bất kỳ sự kiện thay đổi nào.
Đối tượng để liên kết với trạng thái trình phát hiện tại.
Thuộc tính Đối tượng (Xem Cast.framework.ui.PlayerData để biết chi tiết) được cập nhật để phản ánh trạng thái của trình phát mà không kích hoạt sự kiện thay đổi.
Phương thức
addEventListener
addEventListener(type, listener)
Thêm trình nghe để biết các thay đổi về dữ liệu người chơi.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\u003cp\u003eThe \u003ccode\u003ePlayerDataBinder\u003c/code\u003e class binds a player data object to the current player state, updating the data to reflect the state without triggering change events.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to add and remove listeners for player data changes, allowing developers to react to specific events.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eaddEventListener\u003c/code\u003e method enables listening for various player data changes, including any change using \u003ccode\u003ecast.framework.ui.PlayerDataEventType.ANY_CHANGE\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eremoveEventListener\u003c/code\u003e method allows removing previously registered listeners for player data changes.\u003c/p\u003e\n"]]],[],null,["# Class: PlayerDataBinder\n\ncast.[framework](/cast/docs/reference/web_receiver/cast.framework).[ui](/cast/docs/reference/web_receiver/cast.framework.ui).PlayerDataBinder\n=============================================================================================================================================\n\nclass static\n\nThe player data binder. This binds a player data object to the player state.\nThe player data is updated to accurately reflect the current\nplayer state without firing any change events.\n\nConstructor\n-----------\n\n### PlayerDataBinder\n\nnew\nPlayerDataBinder(playerData)\n\n| #### Parameter ||\n|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| playerData | (non-null Object or non-null [cast.framework.ui.PlayerData](/cast/docs/reference/web_receiver/cast.framework.ui.PlayerData)) The object to bind to the current player state. The Object attributes (See cast.framework.ui.PlayerData for details) are updated to reflect the player state without firing a change event. |\n\nMethods\n-------\n\n### addEventListener\n\naddEventListener(type, listener)\n\nAdds a listener for player data changes.\n\n| #### Parameter ||\n|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| type | [cast.framework.ui.PlayerDataEventType](/cast/docs/reference/web_receiver/cast.framework.ui#.PlayerDataEventType) The event type. Use `cast.framework.ui.PlayerDataEventType.ANY_CHANGE` to get notified of any change. Value must not be null. |\n| listener | function(non-null [cast.framework.ui.PlayerDataChangedEvent](/cast/docs/reference/web_receiver/cast.framework.ui.PlayerDataChangedEvent)) |\n\n### removeEventListener\n\nremoveEventListener(type, listener)\n\nRemoves a listener to player data changes.\n\n| #### Parameter ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| type | [cast.framework.ui.PlayerDataEventType](/cast/docs/reference/web_receiver/cast.framework.ui#.PlayerDataEventType) The event type. Value must not be null. |\n| listener | function(non-null [cast.framework.ui.PlayerDataChangedEvent](/cast/docs/reference/web_receiver/cast.framework.ui.PlayerDataChangedEvent)) |"]]