-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added event dispatch for youtube errors #78
base: main
Are you sure you want to change the base?
Added event dispatch for youtube errors #78
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
LGTM! |
onError: (error) => console.error(error), | ||
onError: (error) => { | ||
console.error(error); | ||
this.dispatchEvent(new CustomEvent('error', { detail: error })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this can be handy but the native video API doesn't pass any data with the event. I think we should stay 1:1 as much as possible so a new Event('error')
and then store the last error in a variable and return it in a get error()
property
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great but best to stay as close as possible to the native API.
Fixes #57
Added
dispatchEvent()
call to the errors for YouTubeaddEventListener('error')
to display it in the console in the YouTube video elementThe following screenshot displays how, given an issue with the YouTube video, the console will display the error with all the information
![image](https://private-user-images.githubusercontent.com/29870195/412106496-0cd1591b-a491-428f-9466-c2da5b734149.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2ODIxMzEsIm5iZiI6MTczOTY4MTgzMSwicGF0aCI6Ii8yOTg3MDE5NS80MTIxMDY0OTYtMGNkMTU5MWItYTQ5MS00MjhmLTk0NjYtYzJkYTViNzM0MTQ5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE2VDA0NTcxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAxZTNhYzZmMzU4NzBmODBkMzNkZWUzZTFhZDliOWEwMGJlZTllMzBjMjBmZThmMjVhNzhjNzliMGYxYzVjYjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.ciyiKU7Um69JpSpGYfeavGf7CIyvp_iz-YMm28A8_AY)