Skip to content

Commit

Permalink
feat(xgplayer-m4a): add plugin for converting m4a to fmp4
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangxin92 committed Sep 7, 2018
1 parent f74180d commit 9439d74
Show file tree
Hide file tree
Showing 102 changed files with 15,073 additions and 0 deletions.
5,734 changes: 5,734 additions & 0 deletions packages/xgplayer-m4a/browser/index.js

Large diffs are not rendered by default.

5,745 changes: 5,745 additions & 0 deletions packages/xgplayer-m4a/dist/index.js

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions packages/xgplayer-m4a/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "xgplayer-m4a",
"version": "1.1.0",
"description": "xgplayer plugin for m4a transform to fmp4",
"main": "./dist/index.js",
"scripts": {
"prepare": "npm run build",
"build": "webpack --progress --display-chunks -p",
"watch": "webpack --progress --display-chunks -p --watch"
},
"repository": {
"type": "git",
"url": "git@github.com:bytedance/xgplayer.git"
},
"babel": {
"presets": [
"es2015"
],
"plugins": [
"add-module-exports",
"babel-plugin-bulk-import"
]
},
"keywords": [
"mp4",
"fmp4",
"player",
"audio"
],
"author": "yinguohui@bytedance.com",
"license": "MIT",
"dependencies": {
"babel-loader": "^7.1.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-bulk-import": "^1.0.2",
"babel-preset-es2015": "^6.24.1",
"concat-typed-array": "^1.0.2",
"deepmerge": "^2.0.1",
"event-emitter": "^0.3.5",
"import-local": "^2.0.0",
"json-loader": "^0.5.7",
"webpack": "^4.11.0"
},
"peerDependency": {
"xgplayer": "^0.1.0"
},
"devDependencies": {
"babel-core": "^6.26.3"
}
}
12 changes: 12 additions & 0 deletions packages/xgplayer-m4a/src/error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Player from 'xgplayer'
import {version} from '../package.json'

class _Errors extends Player.Errors {
constructor (type, vid, errd = {}, url = '') {
errd.version = version
super(type, vid, errd)
this.url = url
}
}

export default _Errors
27 changes: 27 additions & 0 deletions packages/xgplayer-m4a/src/fmp4/buffer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Concat from 'concat-typed-array'

class Buffer {
constructor () {
this.buffer = new Uint8Array(0)
}
write (...buffer) {
let self = this
buffer.forEach(item => {
if (item) {
self.buffer = Concat(Uint8Array, self.buffer, item)
} else {
window.console.error(item)
}
})
}
static writeUint32 (value) {
return new Uint8Array([
value >> 24,
(value >> 16) & 0xff,
(value >> 8) & 0xff,
value & 0xff
])
}
}

export default Buffer
Loading

0 comments on commit 9439d74

Please sign in to comment.