You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47-35
Original file line number
Diff line number
Diff line change
@@ -20,59 +20,71 @@ Install the Web Player package using npm:
20
20
npm i @antmedia/web_player
21
21
```
22
22
23
-
## Configuration Parameters
24
-
25
-
The player accepts several configuration parameters, either through the URL or directly in the code:
26
-
27
-
1.`id` (String): The stream ID to play. This parameter is mandatory.
28
-
2.`token` (String): The token for stream access. It's mandatory if token security is enabled on the server side.
29
-
3.`autoplay` (Boolean): Autoplay the stream if available. Optional. Default value is `true`.
30
-
4.`mute` (Boolean): Start playing in mute mode if the stream is available. Optional. Default value is `true`.
31
-
5.`playOrder` (String): The order of technologies used for playing. Optional. Default value is `"webrtc,hls"`. Possible values include `"hls,webrtc"`, `"webrtc"`, `"hls"`, `"vod"`, `"dash"`.
32
-
6.`playType` (String): The order of play types used for playing. Optional. Default value is `"mp4,webm"`. Possible values include `"webm,mp4"`, `"mp4"`, `"webm"`, `"mov"`.
33
-
7.`targetLatency` (Number): The target latency for the DASH player. Optional. Default value is `3`.
34
-
8.`is360` (Boolean): Enable playback in 360 mode. Optional. Default value is `false`.
35
-
36
23
## Usage
37
24
38
25
### Basic Usage
39
26
40
-
Import the `WebPlayer`and initialize it with the desired configuration:
27
+
To use the Web Player, import it and initialize it with the parameters received from the URL. Refer to the Configuration Parameters section below for more details.
41
28
42
-
```javascript
43
-
import { WebPlayer } from"@antmedia/web_player";
29
+
1. In your web application, create a div with the id video_container. This will serve as the container for the player.
44
30
45
-
var embeddedPlayer =newWebPlayer(window, document.getElementById("video_container"), document.getElementById("video_info"));
31
+
```
32
+
<div id="video_container" ></div>
33
+
````
34
+
35
+
2. Initialize the player as follows:
36
+
```javascript
37
+
import { WebPlayer } from "@antmedia/web_player";
46
38
47
-
embeddedPlayer.initialize().then(() => {
39
+
var embeddedPlayer = new WebPlayer(window, document.getElementById("video_container"), null);
40
+
41
+
embeddedPlayer.initialize().then(() => {
48
42
embeddedPlayer.play();
49
-
});
50
-
```
43
+
});
44
+
```
51
45
52
46
The sample for this usage is available in [play.html in StreamApp](https://github.com/ant-media/StreamApp/blob/master/src/main/webapp/play.html)
53
47
54
48
### Advanced Usage
55
-
You can also pass the parameters as an object to the WebPlayer constructor:
console.error("Error while initializing embedded player: " + error);
70
-
});
71
-
```
68
+
});
69
+
```
72
70
73
71
The sample for this usage is available in [app.page.component.ts in Ant-Media-Management-Console](https://github.com/ant-media/Ant-Media-Management-Console/blob/master/src/app/app.page/app.page.component.ts)
74
72
75
73
74
+
## Configuration Parameters
75
+
76
+
The player accepts several configuration parameters, either through the URL or directly in the code:
77
+
78
+
1.`id` (String): The stream ID to play. This parameter is mandatory.
79
+
2.`token` (String): The token for stream access. It's mandatory if token security is enabled on the server side.
80
+
3.`autoplay` (Boolean): Autoplay the stream if available. Optional. Default value is `true`.
81
+
4.`mute` (Boolean): Start playing in mute mode if the stream is available. Optional. Default value is `true`.
82
+
5.`playOrder` (String): The order of technologies used for playing. Optional. Default value is `"webrtc,hls"`. Possible values include `"hls,webrtc"`, `"webrtc"`, `"hls"`, `"vod"`, `"dash"`.
83
+
6.`playType` (String): The order of play types used for playing. Optional. Default value is `"mp4,webm"`. Possible values include `"webm,mp4"`, `"mp4"`, `"webm"`, `"mov"`.
84
+
7.`targetLatency` (Number): The target latency for the DASH player. Optional. Default value is `3`.
85
+
8.`is360` (Boolean): Enable playback in 360 mode. Optional. Default value is `false`.
86
+
87
+
76
88
## Support
77
89
For support and further inquiries, please visit [Ant Media Server's community](https://github.com/orgs/ant-media/discussions). If you are an enterprise user, you can receive support by sending an email to [email protected].
0 commit comments