Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
yqjiang committed Sep 20, 2019
1 parent 315f97d commit 70c7c1d
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 18 deletions.
4 changes: 2 additions & 2 deletions packages/xgplayer-flv.js/browser/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/xgplayer-flv.js/dist/index.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion packages/xgplayer-hls-live/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
"license": "ISC",
"dependencies": {
"xgplayer-remux": "1.0.0"
}
}
12 changes: 7 additions & 5 deletions packages/xgplayer-hls-live/src/demuxer/ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Nalunit from '../../../xgplayer-utils/src/h264/nalunit';
import { AudioTrack, VideoTrack } from '../../../xgplayer-buffer/src/index';
import { AudioTrackSample, VideoTrackSample } from '../../../xgplayer-utils/src/models/trackSample';
import { AudioTrackMeta, VideoTrackMeta } from '../../../xgplayer-utils/src/models/trackMeta';

import { DEMUX_EVENTS } from '../../../xgplayer-utils/src/constants/events'
const StreamType = {
0x01: ['video', 'MPEG-1'],
0x02: ['video', 'MPEG-2'],
Expand Down Expand Up @@ -31,6 +31,8 @@ class TsDemuxer {
this.demuxing = false;
this.pat = [];
this.pmt = [];
this._hasVideoMeta = false;
this._hasAudioMeta = false;
}

init () {
Expand Down Expand Up @@ -76,9 +78,6 @@ class TsDemuxer {
this.pushVideoSample(epeses[j]);
}
}
if (epeses[0].type === 'video') {

}
}
}

Expand All @@ -96,6 +95,8 @@ class TsDemuxer {
sampleRateIndex: pes.ES.frequencyIndex
});
track.meta.refSampleDuration = Math.floor(1024 / track.meta.audioSampleRate * track.meta.timescale);
this._hasAudioMeta = true;
this.emit(DEMUX_EVENTS.METADATA_PARSED, 'video');
} else {
track = this._tracks.audioTrack;
}
Expand Down Expand Up @@ -153,7 +154,8 @@ class TsDemuxer {

if (sps && pps) {
track.meta.avcc = Nalunit.getAvcc(sps.body, pps.body);
console.log(track);
this._hasVideoMeta = true;
this.emit(DEMUX_EVENTS.METADATA_PARSED, 'audio');
}

let data = new Uint8Array(sampleLength);
Expand Down
8 changes: 6 additions & 2 deletions packages/xgplayer-hls-live/src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// TODO: Fix引用
import Context from '../../xgplayer-utils/src/Context';
import { XgBuffer } from '../../xgplayer-buffer/src/index';
import Track from '../../xgplayer-utils/src/models';
import { LOADER_EVENTS } from '../../xgplayer-utils/src/constants/events'
import Track from '../../xgplayer-utils/src/models/trackSample';
import Playlist from './playlist';
import FetchLoader from '../../xgplayer-loader-fetch/src';
import M3U8Parser from './demuxer/m3u8parser';
import TsDemuxer from './demuxer/ts';
import Mp4Remuxer from 'xgplayer-remux/src/mp4/Mp4remux';

class HLSLiveController {
constructor (configs) {
Expand Down Expand Up @@ -38,11 +40,13 @@ class HLSLiveController {
this._context.registry('TS_DEMUXER', TsDemuxer);
this._context.initInstance('TS_DEMUXER', { inputbuffer: 'TS_BUFFER' });

this._context.registry('MP4_REMUXER', Mp4Remuxer);
this._context.initInstance('MP4_REMUXER');
this.initEvents();
}

initEvents () {
this.on('LOADER_COMPLETE', (buffer) => {
this.on(LOADER_EVENTS.LOADER_COMPLETE, (buffer) => {
let tsloader = this._context.getInstance('TS_LOADER')
let m3u8loader = this._context.getInstance('M3U8_LOADER');
if (buffer.TAG === 'M3U8_BUFFER') {
Expand Down
3 changes: 2 additions & 1 deletion packages/xgplayer-remux/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"concat-typed-array": "^1.0.2"
"concat-typed-array": "^1.0.2",
"xgplayer-utils":"^1.1.6-alpha.0"
}
}
10 changes: 5 additions & 5 deletions packages/xgplayer-remux/src/mp4/Mp4remux.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { DEMUX_EVENTS, REMUX_EVENTS } from '../../constants/events'
import MediaSegmentList from '../../models/MediaSegmentList'
import MediaSegment from '../../models/MediaSegment'
import MediaSample from '../../models/MediaSample'
import sniffer from '../../utils/sniffer'
import { DEMUX_EVENTS, REMUX_EVENTS } from 'xgplayer-utils/constants/events'
import MediaSegmentList from 'xgplayer-utils/models/MediaSegmentList'
import MediaSegment from 'xgplayer-utils/models/MediaSegment'
import MediaSample from 'xgplayer-utils/models/MediaSample'
import sniffer from 'xgplayer-utils/sniffer'
import Buffer from '../../write/Buffer'
import Index from './index'

Expand Down

0 comments on commit 70c7c1d

Please sign in to comment.