The recommended solution for embedded content is the Storage Access API, which has broad browser support. (I don't know that YouTube has implemented it yet, but I'd be surprised if it's not there soon.)
https://developer.mozilla.org/en-US/docs/Web/API/Storage_Acc...
https://developers.google.com/privacy-sandbox/3pcd/storage-a...