Skip to content

Commit 22bf858

Browse files
komachicookpete
andauthored
fix: nullify srcObject instead of calling removeAttribute (#1145)
* fix: nullify srcObject instead of calling removeAttribute * Update src/players/FilePlayer.js Co-authored-by: Pete Cook <[email protected]> Co-authored-by: Pete Cook <[email protected]>
1 parent 593802d commit 22bf858

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/players/FilePlayer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default class FilePlayer extends Component {
3838
this.props.url !== prevProps.url &&
3939
!isMediaStream(this.props.url)
4040
) {
41-
this.player.removeAttribute('srcObject')
41+
this.player.srcObject = null
4242
}
4343
}
4444

test/players/FilePlayer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,7 @@ test('clear srcObject on url change', t => {
398398
const url = new MockMediaStream()
399399
const wrapper = shallow(<FilePlayer url={url} config={config} />)
400400
const instance = wrapper.instance()
401-
instance.player.removeAttribute = sinon.fake()
402401
instance.load(url)
403402
wrapper.setProps({ url: 'file.mpv' })
404-
t.true(instance.player.removeAttribute.calledOnceWith('srcObject'))
403+
t.is(instance.player.srcObject, null)
405404
})

0 commit comments

Comments
 (0)