├── .babelrc ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── build ├── can-autoplay.cjs.js ├── can-autoplay.es.js ├── can-autoplay.js └── can-autoplay.min.js ├── index.html ├── lib ├── index.js └── media.js ├── media ├── audio.mp3 └── video.mp4 ├── package.json ├── rollup.config.js ├── test ├── audio.spec.js ├── common.js ├── setup.js └── video.spec.js ├── tools └── blob-generator.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "targets": { 5 | "browsers": ["last 2 versions", "safari >= 8", "ie 11"] 6 | } 7 | }] 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .DS_Store 3 | 4 | # Ignore JetBrains Editor 5 | .idea/ 6 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) 6 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 7 | 8 | ## [3.0.0] - 2018-02-25 9 | 10 | - Added pre-compilation step with Blob Generator 11 | - Changed core implementation where it's now based on blobs 12 | - Changed small media structure where media is stored as a separate local file 13 | - Changed unit tests to work with blob based implementation 14 | - Changed Rollup build to have all builds unified in a single step 15 | - Changed AVA dependency to `0.25.0` 16 | 17 | ## [2.3.2] - 2018-02-15 18 | 19 | - Fixed build by adding missed minified file 20 | 21 | ## [2.3.1] - 2018-02-15 22 | 23 | - Fixed build by adding missed bundled files for CommonJS and ES6 variants 24 | 25 | ## [2.3.0] - 2018-02-15 26 | 27 | - Added option `blob` to use blob as media source instead of base64 28 | 29 | ## [2.2.1] - 2018-02-13 30 | 31 | - Fixed build by adding missed bundled files 32 | 33 | ## [2.2.0] - 2018-02-13 34 | 35 | - Added option `inline` to check auto-play for inline playback 36 | 37 | ## [2.1.1] - 2018-02-02 38 | 39 | - Added notes about media files used in the project 40 | - Fixed imports to provide wrapper Object 41 | 42 | ## [2.1.0] - 2018-02-01 43 | 44 | - Added ES5/ES6 versions of the library for bundlers 45 | 46 | ## [2.0.1] - 2017-12-11 47 | 48 | - Changed documentation to include latest API changes 49 | 50 | ## [2.0.0] - 2017-12-04 51 | 52 | - Added error for timeout 53 | - Added changelog tracking 54 | - Changed DOM test framework to JSDom 55 | - Changed API to use `audio/video` methods with same payload 56 | - Changed playback detection to rely on browser's `play()` Promise API 57 | - Changed documentation to include examples with Promise API 58 | - Removed `videoMuted` method in favor of generic API for `video` and `audio` 59 | - Removed `DOM` invalidation 60 | 61 | ## [1.0.1] - 2017-11-17 62 | 63 | - Added minified version of the library 64 | - Added size badge 65 | - Added more examples 66 | - Changed `Ava` test output 67 | 68 | ## [1.0.0] - 2017-11-16 69 | 70 | - Initial release 71 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 video-dev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # can-autoplay.js 2 | 3 | The auto-play feature detection in HTMLMediaElement (`