Skip to content
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

Remove constructor detect instanceof video #19

Merged
merged 1 commit into from
Jul 23, 2019

Conversation

a-wing
Copy link
Contributor

@a-wing a-wing commented Jul 18, 2019

I am trying to fake a video object to use.

Because look like Browser play plugin don't use <video/>

For example: https://github.com/Kagami/mpv.js

@weizhenye
Copy link
Owner

ASS.js requires <video> to bind events, control playback, and so on. Faking a video object seems not easy.
#11 wants to use ASS.js without <video> too, I don't find out a general way to support those situation yet.

@a-wing
Copy link
Contributor Author

a-wing commented Jul 19, 2019

I am simulating an event on

ass.js need property and event

/**                                           
* HTMLVideoElement                         
*                                                                                             
* HTMLElement -> HTMLMediaElement -> HTMLVideoElement
*                             
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement                           
* HTMLVideoElement.videoHeight :only      
* HTMLVideoElement.videoWidth :only
*                                              
* HTMLMediaElement.paused :only                                                               
* HTMLMediaElement.currentTime  
*                                                                                             
* https://developer.mozilla.org/en-US/docs/Web/API/Element
* Element.clientWidth                                                                         
* Element.clientHeight                      
*                         
*                     
* Events -> Media_events                       
* https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events
* play, pause, seeking                                                                        
*/

But HTMLVideoElement.videoHeight And HTMLVideoElement.videoWidth only read

So can't use HTMLMediaElement

About event. My current solution is:

let video = document.createElement('div');
let event = document.createEvent('Event');
event.initEvent('pause', true, true);

video.dispatchEvent(event);

@weizhenye weizhenye merged commit ccec20f into weizhenye:master Jul 23, 2019
a-wing added a commit to a-wing/endplayer that referenced this pull request Jul 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants