videojs-mobile-ui 0.7.0 → 0.9.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +114 -46
  2. package/dist/videojs-mobile-ui.cjs.js +275 -223
  3. package/dist/videojs-mobile-ui.css +2 -2
  4. package/dist/videojs-mobile-ui.es.js +270 -217
  5. package/dist/videojs-mobile-ui.js +278 -265
  6. package/dist/videojs-mobile-ui.min.js +2 -2
  7. package/docs/api/TouchOverlay.html +964 -0
  8. package/docs/api/fonts/OpenSans-Bold-webfont.eot +0 -0
  9. package/docs/api/fonts/OpenSans-Bold-webfont.svg +1830 -0
  10. package/docs/api/fonts/OpenSans-Bold-webfont.woff +0 -0
  11. package/docs/api/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  12. package/docs/api/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
  13. package/docs/api/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  14. package/docs/api/fonts/OpenSans-Italic-webfont.eot +0 -0
  15. package/docs/api/fonts/OpenSans-Italic-webfont.svg +1830 -0
  16. package/docs/api/fonts/OpenSans-Italic-webfont.woff +0 -0
  17. package/docs/api/fonts/OpenSans-Light-webfont.eot +0 -0
  18. package/docs/api/fonts/OpenSans-Light-webfont.svg +1831 -0
  19. package/docs/api/fonts/OpenSans-Light-webfont.woff +0 -0
  20. package/docs/api/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  21. package/docs/api/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
  22. package/docs/api/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  23. package/docs/api/fonts/OpenSans-Regular-webfont.eot +0 -0
  24. package/docs/api/fonts/OpenSans-Regular-webfont.svg +1831 -0
  25. package/docs/api/fonts/OpenSans-Regular-webfont.woff +0 -0
  26. package/docs/api/global.html +957 -0
  27. package/docs/api/index.html +159 -0
  28. package/docs/api/plugin.js.html +221 -0
  29. package/docs/api/scripts/linenumber.js +25 -0
  30. package/docs/api/scripts/prettify/Apache-License-2.0.txt +202 -0
  31. package/docs/api/scripts/prettify/lang-css.js +2 -0
  32. package/docs/api/scripts/prettify/prettify.js +28 -0
  33. package/docs/api/styles/jsdoc-default.css +358 -0
  34. package/docs/api/styles/prettify-jsdoc.css +111 -0
  35. package/docs/api/styles/prettify-tomorrow.css +132 -0
  36. package/docs/api/swipeFullscreen.js.html +173 -0
  37. package/docs/api/touchOverlay.js.html +211 -0
  38. package/index.html +206 -65
  39. package/package.json +19 -16
  40. package/src/plugin.css +21 -3
  41. package/src/plugin.js +32 -59
  42. package/src/swipeFullscreen.js +117 -0
  43. package/src/touchOverlay.js +62 -56
  44. package/test/plugin.test.js +128 -20
  45. package/test/swipeFullscreen.test.js +365 -0
package/README.md CHANGED
@@ -1,43 +1,58 @@
1
1
  # videojs-mobile-ui
2
2
 
3
- Mobile UI for Video.js.
3
+ > [!WARNING]
4
+ > This branch is a backport for Video.js v7.
5
+ > See the master branch for v8.
4
6
 
5
- Touch controls:
7
+ A more native mobile user experience for Video.js.
6
8
 
7
- - Double-tap the left side of the player to rewind ten seconds
8
- - Double-tap the right side of the player to fast-forward ten seconds
9
- - Single-tap the screen to show a play/pause toggle
9
+ **videojs-mobile-ui** augments the standard Video.js experience into a touch-optimized, mobile-first interface. It adds the intuitive gestures and smart behaviors users expect from top-tier video apps to your browser-based player.
10
10
 
11
- Fullscreen control:
11
+ ## Key Features
12
12
 
13
- - Rotate to landscape to enter Fullscreen
14
- - Lock to fullscreen on rotate
13
+ ### 👆 Touch Controls
15
14
 
16
- ## Table of Contents
15
+ Double-tap to Seek: Just like popular video apps, users can double-tap the left or right side of the video to rewind or fast-forward.
17
16
 
18
- <!-- START doctoc generated TOC please keep comment here to allow auto update -->
19
- <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
20
- ## Installation
17
+ Large play/pause overlay: A large, screen-wide touch zone allows for easy Play/Pause toggling without hunting for tiny buttons.
21
18
 
22
- - [Installation](#installation)
23
- - [Plugin Options](#plugin-options)
24
- - [Default options](#default-options)
25
- - [Options](#options)
26
- - [Usage](#usage)
27
- - [`<script>` Tag](#script-tag)
28
- - [Browserify/CommonJS](#browserifycommonjs)
29
- - [RequireJS/AMD](#requirejsamd)
30
- - [License](#license)
31
-
32
- <!-- END doctoc generated TOC please keep comment here to allow auto update -->
33
- ## Installation
19
+ ### 📱 Fullscreen Orientation:
34
20
 
35
- ```sh
36
- npm install --save videojs-mobile-ui
37
- ```
21
+ Rotate to Watch: Automatically enter fullscreen when the user rotates their phone to landscape.
22
+
23
+ Orientation Lock: Keeps the video fullscreen and locked to landscape mode even if the user tilts their phone back slightly, preventing accidental exits (works on supported devices).
24
+
25
+ ### 🚀 Swipe Gestures (Optional)
26
+
27
+ Enable modern swipe gestures to control the viewing mode.
28
+
29
+ Swipe Up to enter fullscreen with a smooth zoom-in effect.
30
+
31
+ Swipe Down to exit fullscreen naturally.
32
+
33
+ ### 🎨 Configuration Options
34
+
35
+ Visual indicators show exactly how many seconds are being skipped during a seek.
36
+
37
+ Adjust seek times and tap sensitivity to match your specific content needs.
38
+
39
+ ## Compatibility Notes
40
+
41
+ - iOS Safari does not support orientation lock. The fullscreen video on iOS is native and not influenced by this plugin.
42
+ - Android Firefox has native rotate and lock behaviour when an element containing a video is made fullscreen, which will override this plugin.
38
43
 
39
44
  ## Plugin Options
40
45
 
46
+ Newer functionality is opt-in, to not force new features on existing players. Things you might want to add:
47
+
48
+ - `fullscreen.swipeToFullscreen`, to enter fullscreen by swiping up on the video.
49
+ - `fullscreen.swipeFromFullscreen`, to exit fullscreen by swiping down on the video (except iPhone).
50
+ - `touchControls.disableOnEnd`, to disable the touch controls at the end of the video. Useful if you have any sort of endcard displayed at the end of the video that might otherwise conflict.
51
+
52
+ The [demo] page lets you try out the configuration options.
53
+
54
+ ![QR code link to demo page][demo-qr]
55
+
41
56
  ### Default options
42
57
 
43
58
  ```js
@@ -45,27 +60,72 @@ npm install --save videojs-mobile-ui
45
60
  fullscreen: {
46
61
  enterOnRotate: true,
47
62
  exitOnRotate: true,
48
- lockOnRotate: true
63
+ lockOnRotate: true,
64
+ lockToLandscapeOnEnter: false,
65
+ swipeToFullscreen: false,
66
+ swipeFromFullscreen: false,
67
+ disabled: false
49
68
  },
50
69
  touchControls: {
51
70
  seekSeconds: 10,
52
71
  tapTimeout: 300,
53
- disableOnEnd: false
72
+ disableOnEnd: false,
73
+ disabled: false
54
74
  }
55
75
  };
56
76
  ```
57
77
 
58
78
  ### Options
59
79
 
60
- - *fullscreen.enterOnRotate* `boolean` Whether to go fullscreen when rotating to landscape
61
- - *fullscreen.exitOnRotate* `boolean` Whether to leave fullscreen when rotating to portrait (if not locked)
62
- - *fullscreen.lockOnRotate* `boolean` Whether to lock to fullscreen when rotating to landscape
63
- - *fullscreen.iOS* `boolean` Whether to use fake fullscreen on iOS (needed for controls to work)
64
- - *touchControls.seekSeconds* `int` Seconds to seek when double-tapping
65
- - *touchControls.tapTimeout* `int` Milliseconds to consider a double-tap
66
- - *touchControls.disableOnEnd* `boolean` Whether to disable touch controls when the video has ended, e.g. if an endscreen is used. Automatically disables if the endscreen plugin is present when this plugin initialises
80
+ - **`fullscreen`** {Object}
81
+ Options for fullscreen behaviours.
82
+ - **`fullscreen.enterOnRotate`** {boolean}
83
+ If the device is rotated, enter fullscreen.
84
+ Default `true`.
85
+ - **`fullscreen.exitOnRotate`** {boolean}
86
+ If the device is rotated, exit fullscreen, unless `lockOnRotate` is used.
87
+ Default `true`.
88
+ - **`fullscreen.lockOnRotate`** {boolean}
89
+ When going fullscreen in response to rotation (`enterOnRotate`), also lock the orientation (not supported by iOS).
90
+ Default `true`.
91
+ - **`fullscreen.lockToLandscapeOnEnter`** {boolean}
92
+ When fullscreen is entered by any means, lock the orientation (not supported by iOS).
93
+ Default `false`.
94
+ - **`fullscreen.swipeToFullscreen`** {boolean}
95
+ Swipe up to enter fullscreen.
96
+ Default `false`.
97
+ - **`fullscreen.swipeFromFullscreen`** {boolean}
98
+ Swipe down to exit fullscreen.
99
+ Won't do anything on iOS native fullscreen, which has its own swipe down exit gesture.
100
+ Default `false`.
101
+ - **`fullscreen.disabled`** {boolean}
102
+ All fullscreen functionality provided by this plugin disabled.
103
+ Default `false`.
104
+ - **`touchControls`** {Object}
105
+ Options for tap overlay.
106
+ - **`touchControls.seekSeconds`** {number}
107
+ Increment to seek in seconds.
108
+ Default `10`.
109
+ - **`touchControls.tapTimeout`** {number}
110
+ Timeout to consider multiple taps as double rather than two single.
111
+ Default `300`.
112
+ - **`touchControls.disableOnEnd`** {boolean}
113
+ Disable the touch overlay when the video ends.
114
+ Useful if an end screen overlay is used to avoid conflict.
115
+ Default `false`.
116
+ - **`touchControls.disabled`** {boolean}
117
+ All tap overlay functionality provided by this plugin disabled.
118
+ Default `false`.
119
+
120
+ ## Installation
121
+
122
+ Version 1.x requires video.js 8.x as a peer dependency. Lower video.js versions are not supported.
67
123
 
68
- ## Usage
124
+ Version 0.x works with Video.js 7. To install the latest release of 0.x, use the `latest7` tag:
125
+
126
+ ```sh
127
+ npm install videojs-mobile-ui@latest7
128
+ ```
69
129
 
70
130
  To include videojs-mobile-ui on your website or web application, use any of the following methods.
71
131
 
@@ -78,16 +138,23 @@ This is the simplest case. Get the script in whatever way you prefer and include
78
138
  <script src="//path/to/video.min.js"></script>
79
139
  <script src="//path/to/videojs-mobile-ui.min.js"></script>
80
140
  <script>
81
- var player = videojs('my-video');
82
-
83
- player.mobileUi();
141
+ const player = videojs('my-video');
142
+ const pluginOptions = {
143
+ {
144
+ fullscreen: {
145
+ swipeToFullscreen: true
146
+ }
147
+ }
148
+ };
149
+
150
+ player.mobileUi(pluginOptions);
84
151
  </script>
85
152
  ```
86
153
 
87
154
  The release versions will be available on jdselivr, unpkg etc.
88
155
 
89
- * https://cdn.jsdelivr.net/npm/videojs-mobile-ui/dist/videojs-mobile-ui.min.js
90
- * https://cdn.jsdelivr.net/npm/videojs-mobile-ui/dist/videojs-mobile-ui.css
156
+ - https://cdn.jsdelivr.net/npm/videojs-mobile-ui/dist/videojs-mobile-ui.min.js
157
+ - https://cdn.jsdelivr.net/npm/videojs-mobile-ui/dist/videojs-mobile-ui.css
91
158
 
92
159
  ### Browserify/CommonJS
93
160
 
@@ -106,7 +173,7 @@ var player = videojs('my-video');
106
173
  player.mobileUi();
107
174
  ```
108
175
 
109
- Also include the CSS.
176
+ Also include the CSS!
110
177
 
111
178
  ### RequireJS/AMD
112
179
 
@@ -120,7 +187,7 @@ require(['video.js', 'videojs-mobile-ui'], function(videojs) {
120
187
  });
121
188
  ```
122
189
 
123
- Also include the CSS.
190
+ Also include the CSS!
124
191
 
125
192
  ### Import
126
193
 
@@ -136,5 +203,6 @@ import 'videojs-mobile-ui';
136
203
 
137
204
  MIT. Copyright (c) mister-ben &lt;git@misterben.me&gt;
138
205
 
139
-
140
- [videojs]: http://videojs.com/
206
+ [videojs]: http://videojs.org/
207
+ [demo]: https://videojs-mobile-ui.netlify.app
208
+ [demo-qr]: /demo-qr.svg