{"_id":"@youon/videojs-abloop","_rev":"16884356","name":"@youon/videojs-abloop","description":"A video.js plugin allowing looping of a section of video, with GUI and API interface","dist-tags":{"latest":"1.0.2"},"maintainers":[{"name":"bgomes","email":"bgomes@youongroup.com"},{"name":"psilva_uon","email":"psilva@youongroup.com"}],"time":{"modified":"2018-05-25T15:38:59.000Z","created":"2018-05-25T14:48:24.613Z","1.0.2":"2018-05-25T15:38:40.303Z","1.0.1":"2018-05-25T14:48:24.613Z"},"users":{},"author":"","repository":{"type":"git","url":"git+https://bitbucket.org/youonlabs/videojs-abloop.git"},"versions":{"1.0.2":{"name":"@youon/videojs-abloop","version":"1.0.2","description":"A video.js plugin allowing looping of a section of video, with GUI and API interface","main":"videojs-abloop.js","scripts":{"test":"mocha","min":"uglifyjs videojs-abloop.js --compress --mangle -o dist/videojs-abloop.min.js"},"repository":{"type":"git","url":"git+https://bitbucket.org/youonlabs/videojs-abloop.git"},"keywords":["videojs-plugin","videojs"],"author":"","license":"MIT","bugs":{"url":"https://github.com/phhu/videojs-abloop/issues"},"homepage":"https://bitbucket.org/youonlabs/videojs-abloop.git#readme","dependencies":{"chai":"^4.1.2","chai-as-promised":"^7.1.1","http-shutdown":"^1.2.0","mocha":"^5.0.0","node-static":"^0.7.7","selenium-webdriver":"^4.0.0-alpha.1","uglify-js":"^3.3.10"},"files":["dist/"],"gitHead":"9d28b542f8f9929711662a8e789744e0fc565b6b","_id":"@youon/videojs-abloop@1.0.2","_npmVersion":"6.1.0","_nodeVersion":"8.11.2","_npmUser":{"name":"bgomes","email":"bgomes@youongroup.com"},"dist":{"shasum":"8c5dda3b465c2a8b39311a9ac0cb35ffd9bb6497","size":12664,"noattachment":false,"tarball":"https://registry.npm.taobao.org/@youon/videojs-abloop/download/@youon/videojs-abloop-1.0.2.tgz"},"maintainers":[{"name":"bgomes","email":"bgomes@youongroup.com"},{"name":"psilva_uon","email":"psilva@youongroup.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/videojs-abloop_1.0.2_1527262720083_0.9377462804079664"},"_hasShrinkwrap":false,"publish_time":1527262720303,"_cnpm_publish_time":1527262720303},"1.0.1":{"name":"@youon/videojs-abloop","version":"1.0.1","description":"A video.js plugin allowing looping of a section of video, with GUI and API interface","main":"videojs-abloop.js","scripts":{"test":"mocha","min":"uglifyjs videojs-abloop.js --compress --mangle -o dist/videojs-abloop.min.js"},"repository":{"type":"git","url":"git+https://github.com/phhu/videojs-abloop.git"},"keywords":["videojs-plugin","videojs"],"author":"","license":"MIT","bugs":{"url":"https://github.com/phhu/videojs-abloop/issues"},"homepage":"https://github.com/phhu/videojs-abloop#readme","dependencies":{"chai":"^4.1.2","chai-as-promised":"^7.1.1","http-shutdown":"^1.2.0","mocha":"^5.0.0","node-static":"^0.7.7","selenium-webdriver":"^4.0.0-alpha.1","uglify-js":"^3.3.10"},"gitHead":"9526d8fd602b8fcd8b045fb67f9fd13a6bd39717","_id":"@youon/videojs-abloop@1.0.1","_npmVersion":"6.1.0","_nodeVersion":"8.11.2","_npmUser":{"name":"bgomes","email":"bgomes@youongroup.com"},"dist":{"shasum":"4f30907b5565d7279b70f0859d1e97ef0c012d70","size":210740,"noattachment":false,"tarball":"https://registry.npm.taobao.org/@youon/videojs-abloop/download/@youon/videojs-abloop-1.0.1.tgz"},"maintainers":[{"name":"bgomes","email":"bgomes@youongroup.com"},{"name":"psilva_uon","email":"psilva@youongroup.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/videojs-abloop_1.0.1_1527259704420_0.7018354738187738"},"_hasShrinkwrap":false,"publish_time":1527259704613,"_cnpm_publish_time":1527259704613}},"readme":"This is a plugin for video.js (http://videojs.com/)\r\n\r\nIt provides an A/B loop function, allowing a section of a video to be looped over repeatedly.\r\n\r\nThe settings can be changed dynamically, either programmatically or via a user interface.\r\n\r\nExample\r\n=======\r\n\r\nSee https://cdn.rawgit.com/phhu/videojs-abloop/master/sample/basic.html\r\n\r\n```html\r\n\r\n\t\r\n\t\t\r\n\t\t \r\n\t\t\t\t\r\n\t\r\n\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n```\r\n\r\nInterface\r\n=========\r\n\r\nGUI\r\n---\r\n\r\nButtons are created on the right hand side of the control bar to set start and end times for the loop, and to enable and disable looping.\r\n\r\n![GUI screeshot](/images/interfaceScreenshot.png \"GUI screeshot\")\r\n\r\n* Start and end buttons (3rd and 2nd from right, showing times):\r\n * Left click: set start/end time to current video position. \r\n * Right click: skip the video to start/end position. \r\n * Shift + left / right click: move start / end position back / forward (by 0.5s)\r\n * Ctrl + left / right click: move start / end position back / forward (by 0.05s)\r\n\r\n* Loop button (rightmost button):\r\n * Left click: enable / disable looping. \r\n * right click: cycle settings for pausing automatically before or after looping. \r\n * Shift + left/right click: set/extract URL fragment for current loop settings\r\n * Ctrl + left/right click: set/extract full URL for video with current loop settings\r\n * Alt + left/right click: set/extract relative URL for video with current loop settings\r\n\r\nYou can set the buttons not to create using the ```createButtons``` setup option.\r\n\r\nAPI\r\n---\r\n\r\nThe plugin is controlled by an internal opts object that looks something like this.\r\n\r\n```javascript\r\n{\r\n\t\"start\":0,\r\n\t\"end\":10,\r\n\t\"enabled\":false,\r\n\t\"loopIfBeforeStart\":true,\r\n\t\"loopIfAfterEnd\":true,\r\n\t\"pauseBeforeLoop\":false,\r\n\t\"pauseAfterLoop\":false\r\n}\r\n```\r\n\r\nThese can be set on plugin setup or dynamically via API commands.\r\n\r\nAssuming ```video``` references a videojs player instance:\r\n* Look at ```video.abLoopPlugin``` for functions to call to control the loop.\r\n* The API methods can be chained together like this: ```video.abLoopPlugin.setStart().setEnd(8).goToStart().enable();```\r\n* ```setStart``` and ```setEnd``` will set the start and end positions to the current video position if called with no parameter.\r\n* Options can be set with ```video.abLoopPlugin.setOptions({'optionname':value})``` \r\n* Options can be read with ```video.abLoopPlugin.getOptions()``` or to return some options ```video.abLoopPlugin.getOptions([\"start\",\"end\"])```.\r\n * You could save settings by writing this as JSON or whatever (see in samples folder for a crude example).\r\n* An onLoop callback can be set at ```video.abLoopPlugin.onLoopCallBack``` or in the setup options (see example below).\r\n* An onOptionsChange callback can be set at ```video.abLoopPlugin.onOptionsChange``` or in the setup options. This is useful if you implement your own interface.\r\n* You can also get and apply URL fragments to represent the looping section. E.g. ```#t=10,15```. \r\n\r\nAPI commands\r\n------------\r\n\r\n| API command | notes | example |\r\n|-------------|---------|-------|\r\n|setOptions(optionsObject) | Options not specified will not be set | setOptions({\"start\":40,\"end\":45\"}) |\r\n|getOptions(ArrayOfOptionNames?)| Call without an argument to get them all.| getOptions([\"start\",\"end\"])|\r\n|goToStart() | set player currentTime to start time |\r\n|goToEnd() ||\r\n|setStart(startTime?)\t | Call startTime() to set the startTime to the player's currentTime | startTime() startTime(30) startTime(\"0:34:23\") | \r\n|setEnd(endTime?)| Call endTime() to set the startTime to the player's currentTime\r\n|adjustStart(adjustmentInSec) | adjustStart(\"1m30s\") or adjustStart(\"1:20:30\") also work | adjustStart(-5)\r\n|adjustEnd(adjustmentInSec)| \r\n|enable()| enable the plugin.\r\n|disable()| \r\n|toggle()| change enabled status\r\n|togglePauseAfterLooping()| ||\r\n|togglePauseBeforeLooping()| ||\r\n|cyclePauseOnLooping()| cycle between four different compinations of settings for pausing on looping\r\n|validateOptions()| set options to valid values if they are not already. This is called every time the loop condition is checked anyway, but you might want to use it manually if setting options while the player is paused or the plugin disabled\r\n|resetToInitialOptions() | reset options to the ones provided on setup\r\n|playLoop()| for convenience, plays the loop from its start. Equivalent to abLoopPlugin.validateOptions().goToStart().enable().player.play()\r\n|player| reference to parent player object. e.g. video.abLoopPlugin.enable().player.play()\r\n|version| version number\r\n|getAbsoluteUrl()| gets the full URL of the loop - e.g. http://domain.com/path/to/video.mp4#t=12,13\r\n|getUrl()| gets the URL of the loop - e.g. path/to/video.mp4#t=12,13\r\n|getUrlFragment() | gets the loop URL fragment - e.g. #t=12,13\r\n|applyUrl(url) | Set the video source and apply loop start and end as per the t=start,end fragment | applyUrl('http://path/to/video.mp4#t=12,13')|\r\n|applyUrlFragment(urlFragment) | As above, but only sets the loop start and end from the URL hash fragment | applyUrlFragment('#t=12,13') applyUrlFragment('http://path/ignored.mp4#t=12,13')\r\n|loopRequired()| returns true or false depending on whether the loop would be activated in the current state. |\r\n\r\nKeyboard\r\n--------\r\n\r\nYou could use the existing [hotkeys plugin](https://github.com/ctd1500/videojs-hotkeys) to make keyboard controls. See the samples directory for an example.\r\n\r\nSample usage\r\n============\r\n\r\nSee the samples folder for working examples. \r\n\r\nInclude the script:\r\n\r\n```html\r\n\r\n```\r\nAlternatively source it from rawgit.com:\r\n```html\r\n