Skip to content

Commit

Permalink
Fix facebook iframe visibility bug
Browse files Browse the repository at this point in the history
  • Loading branch information
happydev829 committed Sep 20, 2018
1 parent b056089 commit c422548
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/players/Facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export class Facebook extends Component {
this.callPlayer('unmute')
}
this.props.onReady()

// For some reason Facebook have added `visibility: hidden`
// to the iframe when autoplay fails, so here we set it back
document.getElementById(this.playerID).querySelector('iframe').style.visibility = 'visible'
}
})
})
Expand Down
8 changes: 8 additions & 0 deletions test/players/Facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ import testPlayerMethods from '../helpers/testPlayerMethods'
import * as utils from '../../src/utils'
import { Facebook } from '../../src/players/Facebook'

global.document = {
getElementById: () => ({
querySelector: () => ({
style: {}
})
})
}

configure({ adapter: new Adapter() })

const TEST_URL = 'https://www.facebook.com/facebook/videos/10153231379946729'
Expand Down

0 comments on commit c422548

Please sign in to comment.