-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Tech 2.0 #2057
Tech 2.0 #2057
Conversation
You should be able to pass in the swf via an option to the player you're creating: videojs('foo', {
flash: {
swf: "http://google.com"
}
}); Which reminds me, we probably want a way to change these defaults globally so you won't be required to specify it for each player. |
@@ -321,7 +321,7 @@ Flash['checkReady'] = function(tech){ | |||
// Trigger events from the swf on the player | |||
Flash['onEvent'] = function(swfID, eventName){ | |||
let player = Lib.el(swfID)['player']; | |||
player.trigger(eventName); | |||
player.tech.trigger(eventName); |
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.
We should store a reference to the tech on the swf object, probably after it's created. Then we don't need to reference the player here.
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.
Yeah, I think the placeholder was actually a remnant of using swfobject.js, which required you to replace an existing element. #1340 got us a little closer but I think the placeholder could be refactored out now.
This specific line though is the swf's reference to the tech, not the tech's reference to the swf. We need the swf to have a reference because the Flash events get triggered globally and we need to figure out which tech they apply to.
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 an out-dated diff (I think I misplaced my comment for the placeholder). It is now:
let tech = Lib.el(swfID)['tech'];
tech.trigger(eventName);
and the tech is saved within the element instead of the player.
Looking great so far! |
@gkatsev The option is now working. However, it seems like Flash is never sending me the onReady event. Any clue? I'm on Ubuntu / Chrome and Flash works fine. |
@@ -26,9 +26,6 @@ class Flash extends Tech { | |||
|
|||
let { source, parentEl } = options; | |||
|
|||
// Create a temporary element to be replaced by swf object | |||
let placeHolder = this.el_ = Lib.createEl('div', { id: player.id() + '_temp_flash' }); |
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 tried to guess why we were using this placeholder and I ended up looking at 2 years old commits. My only guess is that it was needed in the iframe mode. It seems to work perfectly fine without using it. @heff any clue?
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 believe the placeholder used to be required for the flash fallback back in the day. I think it can be safely removed now.
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.
Yeah, placeholder can be removed now.
* Fires when the browser is intentionally not getting media data | ||
* @event suspend | ||
*/ | ||
onTechSuspend() { |
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.
For these simple ones we could probably loop though a list of the events and create these dynamically. Though it is kind of nice to have an excuse to add the event jsdoc tag.
So it looks like we previously broke Flash. The swf is still told to fire the In videojs/video-js-swf#143 we hardcoded these functions to prevent security issues. So either we'll need to expose window.videojs everywhere again, or create new global functions and release a new version of the swf. |
It would be awesome if we export a different flash-onready function per player on the window object :) |
Is there a way we can do that without opening the security hole back up? |
Oh, right, completely forgot about that. Hm... |
this.on(this.tech, 'pause', this.onTechPause); | ||
this.on(this.tech, 'progress', this.onTechProgress); | ||
this.on(this.tech, 'durationchange', this.onTechDurationChange); | ||
this.on(this.tech, 'fullscreenchange', this.onTechFullscreenChange); |
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.
fullscreenchange is actually a player event, not tech.
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 fullscreenchange listener could still be removed, now that you've added it to the player.
Hopefully I have addressed everything here and we can move on smaller PR now :) |
Big thanks for the merge by the way @heff, very helpful |
Looks like you need to rebase against master again, sorry. On the bright side, the flash tech should be working again :) |
Yay! I'll try tonight :) On Mon, May 4, 2015 at 2:42 PM Gary Katsevman [email protected]
|
Flash is working perfectly now :) let's merge this |
var techReady = function(){ | ||
this.player_.triggerReady(); | ||
}; | ||
var techReady = Lib.bind(this, function() { |
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 think this is duplicating line 297 now? https://github.com/videojs/video.js/pull/2057/files#diff-3b0266ff1c037b289ec624ab25b0272eR297
I want to go ahead and pull this in to prevent further merge conflicts, but there's a list of follow tasks we'll need to do to really finish it off. See #2126. |
Awesome :) I'll take a closer look at all this in the upcoming days |
Woo! |
@eXon do you think you could add any relevant notes for other tech developers to the 5.0 changes? |
Of course. You can add this to #2126 |
I'm starting a pull request to make sure I'm working in the right direction and that everyone agrees with that. (#2008)
By the way I couldn't test Flash because
videojs.options
doesn't exists anymore so I can't set the swf path.Let me know what you guys think.
Roadmap