Skip to content

Commit

Permalink
Merge branch 'main' into feat-ie
Browse files Browse the repository at this point in the history
  • Loading branch information
mister-ben authored Mar 14, 2023
2 parents 9fb1bef + ce7edd9 commit af60e2f
Show file tree
Hide file tree
Showing 11 changed files with 286 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: github-release
name: release
on:
push:
tags:
Expand All @@ -7,7 +7,7 @@ on:
# match semver pre-releases
- "v[0-9]+.[0-9]+.[0-9]+-*"
jobs:
github-release:
release:
env:
NETLIFY_BASE: 'videojs-http-streaming.netlify.app'
runs-on: ubuntu-latest
Expand All @@ -29,12 +29,17 @@ jobs:
with:
node-version: '${{steps.nvm.outputs.NVMRC}}'
cache: npm
# this line is required for the setup-node action to be able to run the npm publish below.
registry-url: 'https://registry.npmjs.org'

- name: npm install
run: npm i --prefer-offline --no-audit

- name: build
run: npm run build-prod --if-present
# publish runs build for us via a prepublishOnly script
- name: npm release
run: npm publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Check if this is a pre-release
run: echo ::set-output name=IS_PRE_RELEASE::$(npx -p not-prerelease is-prerelease && echo "true" || echo "false")
Expand Down Expand Up @@ -67,3 +72,5 @@ jobs:
files: |
dist/**/*.js
dist/**/*.css
discussion_category_name: Releases

23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
<a name="3.1.0"></a>
# [3.1.0](https://github.com/videojs/http-streaming/compare/v3.0.2...v3.1.0) (2023-03-07)

### Features

* add fmp4 emsg ID3 support ([#1370](https://github.com/videojs/http-streaming/issues/1370)) ([906f29e](https://github.com/videojs/http-streaming/commit/906f29e))

### Chores

* npm publish for release workflow ([#1376](https://github.com/videojs/http-streaming/issues/1376)) ([e5b4bf6](https://github.com/videojs/http-streaming/commit/e5b4bf6))

<a name="3.0.2"></a>
## [3.0.2](https://github.com/videojs/http-streaming/compare/v3.0.1...v3.0.2) (2023-02-27)

### Bug Fixes

* CMAF HLS. Source buffer change type is called with wrong codecs sometimes when append segment without init data because of a race condition. ([#1375](https://github.com/videojs/http-streaming/issues/1375)) ([7c3e08e](https://github.com/videojs/http-streaming/commit/7c3e08e))

### Chores

* **changelog:** add missing bug fix ([#1362](https://github.com/videojs/http-streaming/issues/1362)) ([343f682](https://github.com/videojs/http-streaming/commit/343f682))
* update mux.js ([#1372](https://github.com/videojs/http-streaming/issues/1372)) ([1bd22c9](https://github.com/videojs/http-streaming/commit/1bd22c9))

<a name="3.0.1"></a>
## [3.0.1](https://github.com/videojs/http-streaming/compare/v3.0.0...v3.0.1) (2023-01-24)

Expand Down
11 changes: 5 additions & 6 deletions COLLABORATOR_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Install dependencies for the project.
npm install
```

Then, it's mostly a standard npm package release process with running `npm version`, followed by an `npm publish`.
Update version.

```sh
npm version {major|minor|patch}
Expand All @@ -71,17 +71,16 @@ See [deciding what type of version release section](#deciding-what-type-of-versi
Optionally, you can run `git show` now to verify that the version update and CHANGELOG automation worked as expected.

Afterwards, you want to push the commit and the tag to the repo.
It's necessary to do this before running `npm publish` because our GitHub release automation relies on the commit being available on GitHub.

```sh
git push --follow-tags origin main
```

Publish to npm.
After the tag was pushed, GitHub actions will trigger the `release` workflow, which will do the following:

```sh
npm publish
```
* Publish to npm with `next` or `next-{n}` depending on your current major version.
* Create GitHub release with changelog and Netlify preview.
* Create a GitHub `releases` discussion linked to the GitHub release.

If it's a large enough release, consider writing a blog post as well.

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@videojs/http-streaming",
"version": "3.0.1",
"version": "3.1.0",
"description": "Play back HLS and DASH with Video.js, even where it's not natively supported",
"main": "dist/videojs-http-streaming.cjs.js",
"module": "dist/videojs-http-streaming.es.js",
Expand Down Expand Up @@ -63,7 +63,7 @@
"global": "^4.4.0",
"m3u8-parser": "^6.0.0",
"mpd-parser": "^1.0.1",
"mux.js": "6.2.0",
"mux.js": "6.3.0",
"video.js": "^7 || ^8"
},
"peerDependencies": {
Expand Down
19 changes: 17 additions & 2 deletions src/media-segment-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ const handleSegmentBytes = ({
// Note that the start time returned by the probe reflects the baseMediaDecodeTime, as
// that is the true start of the segment (where the playback engine should begin
// decoding).
const finishLoading = (captions) => {
const finishLoading = (captions, id3Frames) => {
// if the track still has audio at this point it is only possible
// for it to be audio only. See `tracks.video && tracks.audio` if statement
// above.
Expand All @@ -471,6 +471,9 @@ const handleSegmentBytes = ({
data: bytesAsUint8Array,
type: trackInfo.hasAudio && !trackInfo.isMuxed ? 'audio' : 'video'
});
if (id3Frames && id3Frames.length) {
id3Fn(segment, id3Frames);
}
if (captions && captions.length) {
captionsFn(segment, captions);
}
Expand Down Expand Up @@ -516,7 +519,19 @@ const handleSegmentBytes = ({
message.logs.forEach(function(log) {
onTransmuxerLog(merge(log, {stream: 'mp4CaptionParser'}));
});
finishLoading(message.captions);

workerCallback({
action: 'probeEmsgID3',
data: bytesAsUint8Array,
transmuxer: segment.transmuxer,
offset: startTime,
callback: ({emsgData, id3Frames}) => {
// transfer bytes back to us
bytes = emsgData.buffer;
segment.bytes = bytesAsUint8Array = emsgData;
finishLoading(message.captions, id3Frames);
}
});
}
});
}
Expand Down
16 changes: 9 additions & 7 deletions src/playlist-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1696,9 +1696,11 @@ export class PlaylistController extends videojs.EventTarget {
audio: this.audioSegmentLoader_.getCurrentMediaInfo_() || {}
};

const playlist = this.mainSegmentLoader_.getPendingSegmentPlaylist() || this.media();

// set "main" media equal to video
media.video = media.main;
const playlistCodecs = codecsForPlaylist(this.main(), this.media());
const playlistCodecs = codecsForPlaylist(this.main(), playlist);
const codecs = {};
const usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;

Expand All @@ -1719,7 +1721,7 @@ export class PlaylistController extends videojs.EventTarget {
// no codecs, no playback.
if (!codecs.audio && !codecs.video) {
this.excludePlaylist({
playlistToExclude: this.media(),
playlistToExclude: playlist,
error: { message: 'Could not determine codecs for playlist.' },
playlistExclusionDuration: Infinity
});
Expand All @@ -1744,13 +1746,13 @@ export class PlaylistController extends videojs.EventTarget {
}
});

if (usingAudioLoader && unsupportedAudio && this.media().attributes.AUDIO) {
const audioGroup = this.media().attributes.AUDIO;
if (usingAudioLoader && unsupportedAudio && playlist.attributes.AUDIO) {
const audioGroup = playlist.attributes.AUDIO;

this.main().playlists.forEach(variant => {
const variantAudioGroup = variant.attributes && variant.attributes.AUDIO;

if (variantAudioGroup === audioGroup && variant !== this.media()) {
if (variantAudioGroup === audioGroup && variant !== playlist) {
variant.excludeUntil = Infinity;
}
});
Expand All @@ -1771,7 +1773,7 @@ export class PlaylistController extends videojs.EventTarget {
}, '') + '.';

this.excludePlaylist({
playlistToExclude: this.media(),
playlistToExclude: playlist,
error: {
internal: true,
message
Expand All @@ -1798,7 +1800,7 @@ export class PlaylistController extends videojs.EventTarget {

if (switchMessages.length) {
this.excludePlaylist({
playlistToExclude: this.media(),
playlistToExclude: playlist,
error: {
message: `Codec switching not supported: ${switchMessages.join(', ')}.`,
internal: true
Expand Down
5 changes: 5 additions & 0 deletions src/segment-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,7 @@ export default class SegmentLoader extends videojs.EventTarget {
*/
resetEverything(done) {
this.ended_ = false;
this.activeInitSegmentId_ = null;
this.appendInitSegment_ = {
audio: true,
video: true
Expand Down Expand Up @@ -1983,6 +1984,10 @@ export default class SegmentLoader extends videojs.EventTarget {
return this.getCurrentMediaInfo_(segmentInfo) || this.startingMediaInfo_;
}

getPendingSegmentPlaylist() {
return this.pendingSegment_ ? this.pendingSegment_.playlist : null;
}

hasEnoughInfoToAppend_() {
if (!this.sourceUpdater_.ready()) {
return false;
Expand Down
18 changes: 18 additions & 0 deletions src/transmuxer-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,24 @@ class MessageHandlers {
}, [data.buffer]);
}

/**
* Probes an mp4 segment for EMSG boxes containing ID3 data.
* https://aomediacodec.github.io/id3-emsg/
*
* @param {Uint8Array} data segment data
* @param {number} offset segment start time
* @return {Object[]} an array of ID3 frames
*/
probeEmsgID3({data, offset}) {
const id3Frames = mp4probe.getEmsgID3(data, offset);

this.self.postMessage({
action: 'probeEmsgID3',
id3Frames,
emsgData: data
}, [data.buffer]);
}

/**
* Probe an mpeg2-ts segment to determine the start time of the segment in it's
* internal "media time," as well as whether it contains video and/or audio.
Expand Down
Loading

0 comments on commit af60e2f

Please sign in to comment.