-
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
Fix NO_SRC when play is hit before the video elem src is set #3378
Changes from 5 commits
4c296d9
313bbe5
83adffd
86702fb
4e7ec46
ec9ecf2
74a3562
7c4f312
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,6 +308,12 @@ class Tech extends Component { | |
return createTimeRange(); | ||
} | ||
|
||
delayedPlay() { | ||
this.el_.onloadstart = function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you should be able to do |
||
this.play(); | ||
}; | ||
} | ||
|
||
/** | ||
* Set current time | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -247,15 +247,15 @@ test('should hide the poster when play is called', function() { | |
}); | ||
|
||
equal(player.hasStarted(), false, 'the show poster flag is true before play'); | ||
player.play(); | ||
player.tech_.trigger('play'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you also fix this by mocking currentSrc()? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was originally getting an error about the method currentSrc() not existing(likely since the tests use a fake tech.) I looked at how some of the other tests were written and saw that they almost exclusively trigger play in this way so I went with this instead. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it's consistent with the other tests that seems reasonable |
||
equal(player.hasStarted(), true, 'the show poster flag is false after play'); | ||
|
||
player.tech_.trigger('loadstart'); | ||
equal(player.hasStarted(), | ||
false, | ||
'the resource selection algorithm sets the show poster flag to true'); | ||
|
||
player.play(); | ||
player.tech_.trigger('play'); | ||
equal(player.hasStarted(), true, 'the show poster flag is false after play'); | ||
}); | ||
|
||
|
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.
You should be able to just do
this.currentSrc()
here, since the context is already the player itself. We also may want to dothis.src() || this.currentSrc()
to make sure that we catch issues where thesrc
is set butcurrentSrc
isn't (can happen when adblock is involved.