Skip to content
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: remove setRequestHeader #91

Merged
merged 1 commit into from
May 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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