Skip to content

Commit

Permalink
Merge pull request #1241 from canalplus/feat/track-info-on-media-error
Browse files Browse the repository at this point in the history
Add `trackInfo` property to some `MediaError`
  • Loading branch information
peaBerberian committed Sep 26, 2023
2 parents 88953e3 + 26c6ab9 commit c3549af
Show file tree
Hide file tree
Showing 474 changed files with 23,476 additions and 79,669 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ module.exports = {
"prefer-template": "off",
"no-restricted-properties": [
"error",
{
"object": "window",
"message": "`window` doesn't work in Node.JS and only works when JavaScript is running in the main thread. Please import `globalScope` instead.",
},
{
"object": "Object",
"property": "assign",
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
/tests/performance/package.json
/tests/performance/package-lock.json

/dist/_esm5.processed
/dist/_esm5.raw
/dist/

/doc/generated

Expand Down
172 changes: 172 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

40 changes: 27 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,39 @@ Those have to follow the conventions defined below.



## Reading the current code
## Important code concepts

Even if we hope the current code is straightforward, readable and commented
enough we can still admit that going blind into the codebase can be hard at
first as this is a pretty big technical project on a specific matter.
### Code documentation

We thus encourage you to rely on the architecture documentation you can usually
find alongside the code, in `README.md` files.
You can for example start by reading `src/README.md`, to have a clearer idea
of the general code architecture of the player.
We try to put `README.md` files inside every significant directories inside
`/src` to provide a global architecture documentation of that directory
specifically.

You can try to start understanding a piece of RxPlayer code by navigating
to that file. Understand that the documented behavior may be out of date
(in which case you're welcome to update it or open an issue) though even in
that case, it is a good starting point to understand the directory's role.
Likewise, don't forget to update it if a change you made to the code
necessitates a documentation change.

Also, for a more exhaustive approach to the documentation of the project's file
organization, you can look at [`FILES.md`](./FILES.md).

The code of the RxPlayer being heavily modularized, you should not need to read
the whole documentation to be ready, only the parts you want to update
(hopefully!).
### When renaming or deleting functions, classes or variables

When Refactoring/Renaming, make sure to grep any of the renamed class / function
/ variable's name as they may also be referenced in documentation and code
comments. Same thing for a directory or file name.

If the name is hard to grep (e.g. the name is too generic and thus has too many
false positives), you can generally reduce the area to comments in the same file
and documentation files in the same directory.

### `features` object

Some files should not be imported directly but only be accessed by going through
the `features` object exported at `/src/features`. This is to reduce bundle size
when an application doesn't need all of the RxPlayer's features.



Expand All @@ -53,8 +69,6 @@ directory) by calling `npm run lint:tests`.

### Types

#### General TypeScript rules

We try to be as strict as possible with types:

- the `any` type should be avoided
Expand Down
1 change: 0 additions & 1 deletion FILES.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ What is exported there are functions to load:
- Manifests/MPDs
- video/audio segments
- subtitles tracks
- image tracks

For different streaming technologies.

Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,6 @@ npm run test
npm run list
```

Builds are included in the ``dist/`` directory (builds based on the last version
are already included there).



## Why a new player? ###########################################################

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.30.0
4.0.0-beta.2
24 changes: 0 additions & 24 deletions appveyor.yml

This file was deleted.

1 change: 0 additions & 1 deletion demo/full/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<link rel="stylesheet" href="styles/style.css" media="screen">
<link rel="icon" type="image/x-icon" href="plus.ico" />
<script type="text/javascript" src="./bundle.js" charset="utf-8"></script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
<title>RxPlayer - CANAL+</title>
</head>
<body>
Expand Down
15 changes: 11 additions & 4 deletions demo/full/scripts/components/BufferContentGraph.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import * as React from "react";
import type { IRepresentation } from "../../../../src/public_types";
import type {
IAudioRepresentation,
IVideoRepresentation,
} from "../../../../src/public_types";
import capitalizeFirstLetter from "../lib/capitalizeFirstLetter";
import shuffleArray from "../lib/shuffleArray";
import type { IBufferedData } from "../modules/player/index";
import ToolTip from "./ToolTip";

type IRepresentation = IAudioRepresentation | IVideoRepresentation;

const {
useEffect,
useMemo,
Expand Down Expand Up @@ -258,12 +263,14 @@ export default function BufferContentGraph({

let newTipText = "";
switch (adaptation.type) {
case "video":
newTipText += `width: ${representation.width ?? "?"}` + "\n" +
`height: ${representation.height ?? "?"}` + "\n" +
case "video": {
const rep = representation as IVideoRepresentation;
newTipText += `width: ${rep.width ?? "?"}` + "\n" +
`height: ${rep.height ?? "?"}` + "\n" +
`codec: ${representation.codec ?? "?"}` + "\n" +
`bitrate: ${representation.bitrate ?? "?"}` + "\n";
break;
}
case "audio":
newTipText += `language: ${adaptation.language ?? "?"}` + "\n" +
`audioDescription: ${
Expand Down
61 changes: 61 additions & 0 deletions demo/full/scripts/components/GitHubButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import * as React from "react";
import { render } from "github-buttons";

const {
useEffect,
useRef,
} = React;

const GitHubButton = ({
href,
ariaLabel,
dataColorScheme = "dark_high_contrast",
dataIcon,
dataShowCount,
dataSize = "large",
dataText,
title,
children,
}: {
href: string;
ariaLabel?: string;
dataColorScheme?: string;
dataIcon?: string;
dataShowCount?: boolean | string;
dataSize?: string;
dataText?: string;
title?: string;
children?: React.ReactNode;
}): JSX.Element => {
const aRef = useRef<HTMLAnchorElement>(null);

useEffect(() => {
const aElement = aRef.current;
if (aElement !== null) {
render(
aElement,
newA => aElement?.parentNode?.replaceChild(newA, aElement),
);
}
});

return (
<span className="button-gh">
<a
ref={aRef}
href={href}
aria-label={ariaLabel}
data-icon={dataIcon}
data-color-scheme={dataColorScheme}
data-show-count={dataShowCount}
data-size={dataSize}
data-text={dataText}
title={title}
>
{children}
</a>
</span>
);
};

export default GitHubButton;
58 changes: 0 additions & 58 deletions demo/full/scripts/components/ImageThumbnail.tsx

This file was deleted.

Loading

0 comments on commit c3549af

Please sign in to comment.