Skip to content

Commit

Permalink
fix: remove setRequestHeader (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyuhen authored May 13, 2019
1 parent afd476d commit a1926bf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
2 changes: 0 additions & 2 deletions packages/griffith-mp4/src/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export default class FragmentFetch {
xhr.open('get', url)
xhr.responseType = 'arraybuffer'
xhr.setRequestHeader('Range', `bytes=${start}-${end}`)
xhr.setRequestHeader('Access-Control-Allow-Methods', 'GET, OPTIONS')
xhr.setRequestHeader('Access-Control-Allow-Origin', '*')
xhr.onload = () => {
if (xhr.status === 200 || xhr.status === 206) {
callback(xhr.response)
Expand Down
18 changes: 12 additions & 6 deletions packages/griffith-standalone/README-zh-Hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,24 @@

```html
<div id="player"></div>
<script
crossorigin
src="https://unpkg.com/griffith-standalone/dist/index.umd.min.js"
></script>
<script src="https://unpkg.com/griffith-standalone/dist/index.umd.min.js"></script>
<script>
const target = document.getElementById('player')
const sources = {
hd: {
play_url: 'https://zhstatic.zhihu.com/cfe/griffith/zhihu2018_hd.mp4',
},
sd: {
play_url: 'https://zhstatic.zhihu.com/cfe/griffith/zhihu2018_sd.mp4',
},
}
// 创建播放器
const player = Griffith.createPlayer(element)
const player = Griffith.createPlayer(target)
// 载入视频
player.render(props)
player.render({sources})
// 销毁视频
player.dispose()
Expand Down
13 changes: 11 additions & 2 deletions packages/griffith-standalone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,20 @@ Griffith bundled with React, React DOM and other dependencies. You can use it by
<script>
const target = document.getElementById('player')
const sources = {
hd: {
play_url: 'https://zhstatic.zhihu.com/cfe/griffith/zhihu2018_hd.mp4',
},
sd: {
play_url: 'https://zhstatic.zhihu.com/cfe/griffith/zhihu2018_sd.mp4',
},
}
// create player instance
const player = Griffith.createPlayer(element)
const player = Griffith.createPlayer(target)
// load video
player.render(props)
player.render({sources})
// dispose video
player.dispose()
Expand Down

0 comments on commit a1926bf

Please sign in to comment.