{"action":"created","issue":{"url":"https://api.github.com/repos/videojs/video.js/issues/5015","repository_url":"https://api.github.com/repos/videojs/video.js","labels_url":"https://api.github.com/repos/videojs/video.js/issues/5015/labels{/name}","comments_url":"https://api.github.com/repos/videojs/video.js/issues/5015/comments","events_url":"https://api.github.com/repos/videojs/video.js/issues/5015/events","html_url":"https://github.com/videojs/video.js/issues/5015","id":305287479,"number":5015,"title":"resizeHandler still triggering events after player disposed","user":{"login":"santialbo","id":1557563,"avatar_url":"https://avatars3.githubusercontent.com/u/1557563?v=4","gravatar_id":"","url":"https://api.github.com/users/santialbo","html_url":"https://github.com/santialbo","followers_url":"https://api.github.com/users/santialbo/followers","following_url":"https://api.github.com/users/santialbo/following{/other_user}","gists_url":"https://api.github.com/users/santialbo/gists{/gist_id}","starred_url":"https://api.github.com/users/santialbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santialbo/subscriptions","organizations_url":"https://api.github.com/users/santialbo/orgs","repos_url":"https://api.github.com/users/santialbo/repos","events_url":"https://api.github.com/users/santialbo/events{/privacy}","received_events_url":"https://api.github.com/users/santialbo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-03-14T18:55:09Z","updated_at":"2018-03-15T14:09:00Z","closed_at":"2018-03-15T12:17:43Z","author_association":"NONE","body":"## Description\r\nI'm getting a somewhat hard to reproduce bug. I'm using Angular 5 in order to create a video component with the videojs/videojs-youtube tech.\r\n\r\nI'm instantiating the player on the `ngAfterViewInit` lifecyle method (this is where you would usually do it with other non-angular libraries) and everything is OK.\r\n\r\nHowever when destroying the component, in the `ngOnDestroy` method I call the following methods:\r\n\r\n```ts\r\n      this.player.off('timeupdate', this.onTimeUpdate); // unregistering an event that is just logging the progress\r\n      this.player.dispose();\r\n```\r\nWhat happens is `.dispose()` is throwing the following Exception\r\n\r\n```\r\nError: The YouTube player is not attached to the DOM.\r\n    at Y.g.B (https://s.ytimg.com/yts/jsbin/www-widgetapi-vfllf5xrd/www-widgetapi.js:94:224)\r\n    at X (https://s.ytimg.com/yts/jsbin/www-widgetapi-vfllf5xrd/www-widgetapi.js:86:99)\r\n    at Y.(anonymous function).getCurrentTime.bb.(anonymous function) [as stopVideo] (https://s.ytimg.com/yts/jsbin/www-widgetapi-vfllf5xrd/www-widgetapi.js:104:124)\r\n    at constructor.dispose (http://localhost:6006/static/preview.bundle.js:177702:25)\r\n    at Player.dispose (http://localhost:6006/static/preview.bundle.js:168068:18)\r\n    at VideoComponent.ngOnDestroy (http://localhost:6006/static/preview.bundle.js:148955:25)\r\n```\r\nIf I catch it, on Chrome (Firefox is OK) I get the following Exception\r\n\r\n```\r\nvideo.cjs.js:1597 Uncaught TypeError: Cannot read property 'vdata1521052985455' of null\r\n    at hasData (video.cjs.js:1597)\r\n    at trigger (video.cjs.js:2023)\r\n    at Player.trigger$$1 [as trigger] (video.cjs.js:2898)\r\n    at ResizeManager.resizeHandler (video.cjs.js:16750)\r\n    at ResizeObserver.<anonymous> (video.cjs.js:16711)\r\n    at Player.later (video.cjs.js:2362)\r\n    at bound (video.cjs.js:2282)\r\n    at ZoneDelegate.invokeTask (zone.js:421)\r\n    at Zone.runTask (zone.js:188)\r\n    at ZoneTask.invokeTask (zone.js:496)\r\n```\r\nSo it looks like the ResizeManager is triggering a `playerresize` Event.\r\n\r\nDo you have any hints or ideas of what could be causing this?\r\n\r\nThanks a lot\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/videojs/video.js/issues/comments/373388145","html_url":"https://github.com/videojs/video.js/issues/5015#issuecomment-373388145","issue_url":"https://api.github.com/repos/videojs/video.js/issues/5015","id":373388145,"user":{"login":"gkatsev","id":535884,"avatar_url":"https://avatars0.githubusercontent.com/u/535884?v=4","gravatar_id":"","url":"https://api.github.com/users/gkatsev","html_url":"https://github.com/gkatsev","followers_url":"https://api.github.com/users/gkatsev/followers","following_url":"https://api.github.com/users/gkatsev/following{/other_user}","gists_url":"https://api.github.com/users/gkatsev/gists{/gist_id}","starred_url":"https://api.github.com/users/gkatsev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkatsev/subscriptions","organizations_url":"https://api.github.com/users/gkatsev/orgs","repos_url":"https://api.github.com/users/gkatsev/repos","events_url":"https://api.github.com/users/gkatsev/events{/privacy}","received_events_url":"https://api.github.com/users/gkatsev/received_events","type":"User","site_admin":false},"created_at":"2018-03-15T14:09:00Z","updated_at":"2018-03-15T14:09:00Z","author_association":"OWNER","body":"Ah, that would make sense. a lot of the work that Video.js does regarding events is tied to the DOM element associated with the component, so, if the DOM element is removed, video.js won't be able to remove the event listeners.\r\nWe really do need a better error for this issue so that at least it leads you in the right direction."}}
{"actor":{"display_login":"gkatsev"}}