|
@@ -1,15 +1,15 @@
|
1
|
1
|
# Video Player
|
2
|
2
|
|
3
|
|
-An A-Frame solution for playing videos in AR. `<ar-video-player>` is tailored for AR with encantar.js. Unlike A-Frame's standard `<a-video>`, `<ar-video-player>` handles corner cases for AR and includes easy-to-use controls, so you can focus on creating your projects rather than dealing with the various technicalities and edge cases of video playback on the browser.
|
4
|
|
-
|
5
|
|
-<div style="text-align: center">
|
6
|
|
-<iframe width="560" height="315" src="https://www.youtube.com/embed/sz4Fmf3zyho?si=e4Ry5jcYAvxPfAKe" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
|
7
|
|
-</div>
|
|
3
|
+An A-Frame component and primitive for playing videos in AR. `<ar-video-player>` is tailored for encantar.js. Unlike A-Frame's standard `<a-video>`, `<ar-video-player>` handles corner cases for AR and includes easy-to-use controls, so you can focus on creating and designing your projects rather than dealing with the various technicalities of video playback in the browser.
|
8
|
4
|
|
9
|
5
|
!!! tip "It's easy to use!"
|
10
|
6
|
|
11
|
7
|
The Video Player Add-On includes a working demo that you can easily modify. This page documents it in depth and is meant to be used as a reference.
|
12
|
8
|
|
|
9
|
+<div style="text-align: center">
|
|
10
|
+<iframe width="560" height="315" src="https://www.youtube.com/embed/sz4Fmf3zyho?si=e4Ry5jcYAvxPfAKe" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
|
|
11
|
+</div>
|
|
12
|
+
|
13
|
13
|
## Properties
|
14
|
14
|
|
15
|
15
|
| Property | Description | Default |
|
|
@@ -39,7 +39,7 @@ An A-Frame solution for playing videos in AR. `<ar-video-player>` is tailored fo
|
39
|
39
|
</a-assets>
|
40
|
40
|
```
|
41
|
41
|
|
42
|
|
-!!! tip "Aspect ratio"
|
|
42
|
+!!! info "Aspect ratio"
|
43
|
43
|
|
44
|
44
|
Make sure that the `width` and the `height` of your `<ar-video-player>` match the aspect ratio of your video. The default size is appropriate for the commonly used 16:9 widescreen ratio.
|
45
|
45
|
|
|
@@ -54,8 +54,8 @@ Add the `ar-video-control` component to a descendant of `<ar-video-player>` as i
|
54
|
54
|
```html
|
55
|
55
|
<ar-video-player src="#my-video">
|
56
|
56
|
|
57
|
|
- <!-- The play button is a descendant of ar-video-player -->
|
58
|
|
- <ar-button id="play-button" position="0 0.9 0"
|
|
57
|
+ <!-- The play button is placed inside ar-video-player -->
|
|
58
|
+ <ar-button id="play-button" position="0 -0.9 0"
|
59
|
59
|
ar-video-control="action: play"
|
60
|
60
|
></ar-button>
|
61
|
61
|
|
|
@@ -80,6 +80,7 @@ Add the `ar-video-control` component to a descendant of `<ar-video-player>` as i
|
80
|
80
|
| `"mute"` | Mute the video. |
|
81
|
81
|
| `"unmute"` | Unmute the video. |
|
82
|
82
|
| `"toggleAudio"` | Toggle the audio. |
|
|
83
|
+| `""` | Do nothing. |
|
83
|
84
|
|
84
|
85
|
## Declarative handlers
|
85
|
86
|
|
|
@@ -113,7 +114,7 @@ These handlers can be added to `<ar-video-player>` itself or to any of its desce
|
113
|
114
|
Make it disappear when the video ends or is paused. -->
|
114
|
115
|
<ar-video-player src="#my-video">
|
115
|
116
|
|
116
|
|
- <!-- The pause button is a descendant of ar-video-player -->
|
|
117
|
+ <!-- The pause button is placed inside ar-video-player -->
|
117
|
118
|
<ar-button id="pause-button" position="0 -0.9 0"
|
118
|
119
|
visible="false" enabled="false"
|
119
|
120
|
ar-onvideoplay="visible: true; ar-button.enabled: true"
|
|
@@ -136,7 +137,7 @@ The following special properties are used to further customize the declarative h
|
136
|
137
|
|
137
|
138
|
!!! question "What about event-set?"
|
138
|
139
|
|
139
|
|
- Declarative handlers are similar to A-Frame's event-set in their usage, but there are differences behind the scenes. Whenever working with the Video Player, usage of the declarative handlers presented in this page is preferred.
|
|
140
|
+ Declarative handlers are similar to A-Frame's event-set in their usage, but there are differences behind the scenes. Whenever working with the Video Player, usage of the declarative handlers presented in this page is recommended.
|
140
|
141
|
|
141
|
142
|
### Multiple handlers
|
142
|
143
|
|
|
@@ -171,8 +172,8 @@ The `<ar-video-player>` emits the following events based on the state of the und
|
171
|
172
|
|
172
|
173
|
| Method | Description |
|
173
|
174
|
| ------ | ----------- |
|
174
|
|
-| `invoke(action)` | Perform an [action](#video-controls). |
|
|
175
|
+| `invoke(action)` | Perform an [action](#actions). |
|
175
|
176
|
|
176
|
177
|
## Autoplay
|
177
|
178
|
|
178
|
|
-Usage of the `autoplay` attribute on the `<video>` tag is discouraged. Video playback may be blocked due to browser policies and the Video Player will not show up in AR as soon as the page is loaded. It's typically better to wait for user input in order to initiate the playback, e.g., have the user click on a play button. If the page receives no user interaction, then you may still play your video as long as it's muted. See also: [artargetfound](../api/plugin-aframe.md#artargetfound) event.
|
|
179
|
+Usage of the `autoplay` attribute on the `<video>` tag is discouraged. Video playback may be blocked due to browser policies. In addition, the Video Player will not show up in AR at the exact moment the page is loaded. It's typically better to wait for user input in order to initiate the playback, e.g., have the user click on a play button. If the page receives no user interaction, then you may still play your video as long as it's muted. See also: [artargetfound](../api/plugin-aframe.md#artargetfound) event.
|