diff --git a/404.html b/404.html index 22e0f7ab9..eb0a94fa1 100644 --- a/404.html +++ b/404.html @@ -5,13 +5,13 @@ Page Not Found | React Native Track Player - - + +
-
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

+ + \ No newline at end of file diff --git a/assets/js/578de3c1.17357c31.js b/assets/js/00bde185.7702eee5.js similarity index 95% rename from assets/js/578de3c1.17357c31.js rename to assets/js/00bde185.7702eee5.js index f93e082cb..77c268b31 100644 --- a/assets/js/578de3c1.17357c31.js +++ b/assets/js/00bde185.7702eee5.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[4664],{3905:function(t,e,n){n.d(e,{Zo:function(){return c},kt:function(){return s}});var r=n(7294);function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e=0||(a[n]=t[n]);return a}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}var p=r.createContext({}),d=function(t){var e=r.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):i(i({},e),t)),n},c=function(t){var e=d(t.components);return r.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},u=r.forwardRef((function(t,e){var n=t.components,a=t.mdxType,l=t.originalType,p=t.parentName,c=o(t,["components","mdxType","originalType","parentName"]),u=d(n),s=a,k=u["".concat(p,".").concat(s)]||u[s]||m[s]||l;return n?r.createElement(k,i(i({ref:e},c),{},{components:n})):r.createElement(k,i({ref:e},c))}));function s(t,e){var n=arguments,a=e&&e.mdxType;if("string"==typeof t||a){var l=n.length,i=new Array(l);i[0]=u;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:a,i[1]=o;for(var d=2;d=0||(a[n]=t[n]);return a}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}var p=r.createContext({}),d=function(t){var e=r.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):i(i({},e),t)),n},c=function(t){var e=d(t.components);return r.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},u=r.forwardRef((function(t,e){var n=t.components,a=t.mdxType,l=t.originalType,p=t.parentName,c=o(t,["components","mdxType","originalType","parentName"]),u=d(n),s=a,k=u["".concat(p,".").concat(s)]||u[s]||m[s]||l;return n?r.createElement(k,i(i({ref:e},c),{},{components:n})):r.createElement(k,i({ref:e},c))}));function s(t,e){var n=arguments,a=e&&e.mdxType;if("string"==typeof t||a){var l=n.length,i=new Array(l);i[0]=u;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:a,i[1]=o;for(var d=2;d=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},l=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),l=s(n),f=o,m=l["".concat(p,".").concat(f)]||l[f]||d[f]||a;return n?r.createElement(m,i(i({ref:t},u),{},{components:n})):r.createElement(m,i({ref:t},u))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=l;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var s=2;s=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},l=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),l=s(n),f=o,m=l["".concat(p,".").concat(f)]||l[f]||d[f]||a;return n?r.createElement(m,i(i({ref:t},u),{},{components:n})):r.createElement(m,i({ref:t},u))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=l;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var s=2;s=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),k=s(n),c=r,m=k["".concat(p,".").concat(c)]||k[c]||u[c]||l;return n?a.createElement(m,o(o({ref:t},d),{},{components:n})):a.createElement(m,o({ref:t},d))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=k;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var s=2;ssetupPlayer(options)",id:"setupplayeroptions",level:2},{value:"updateOptions(options)",id:"updateoptionsoptions",level:2},{value:"play()",id:"play",level:2},{value:"pause()",id:"pause",level:2},{value:"stop()",id:"stop",level:2},{value:"retry()",id:"retry",level:2},{value:"seekBy(offset)",id:"seekbyoffset",level:2},{value:"seekTo(seconds)",id:"seektoseconds",level:2},{value:"setVolume(volume)",id:"setvolumevolume",level:2},{value:"getVolume()",id:"getvolume",level:2},{value:"setRate(rate)",id:"setraterate",level:2},{value:"getRate()",id:"getrate",level:2},{value:"getProgress()",id:"getprogress",level:2},{value:"getPlaybackState()",id:"getplaybackstate",level:2},{value:"getPlayWhenReady()",id:"getplaywhenready",level:2},{value:"setPlayWhenReady(playWhenReady)",id:"setplaywhenreadyplaywhenready",level:2},{value:"\u26a0\ufe0f getState()",id:"\ufe0f-getstate",level:2},{value:"\u26a0\ufe0f getDuration()",id:"\ufe0f-getduration",level:2},{value:"\u26a0\ufe0f getPosition()",id:"\ufe0f-getposition",level:2},{value:"\u26a0\ufe0f getBufferedPosition()",id:"\ufe0f-getbufferedposition",level:2}],k={toc:u};function c(e){var t=e.components,n=(0,r.Z)(e,o);return(0,l.kt)("wrapper",(0,a.Z)({},k,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"player"},"Player"),(0,l.kt)("h2",{id:"setupplayeroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"setupPlayer(options)")),(0,l.kt)("p",null,"Accepts a ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/player-options"},(0,l.kt)("inlineCode",{parentName:"a"},"PlayerOptions"))," object."),(0,l.kt)("h2",{id:"updateoptionsoptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"updateOptions(options)")),(0,l.kt)("p",null,"Accepts a ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/update-options"},(0,l.kt)("inlineCode",{parentName:"a"},"UpdateOptions"))," object. Updates\nthe configuration for the components."),(0,l.kt)("p",null,"\u26a0\ufe0f These parameters are different than the ones set using ",(0,l.kt)("inlineCode",{parentName:"p"},"setupPlayer()"),".\nParameters other than those listed below will not be applied."),(0,l.kt)("h2",{id:"play"},(0,l.kt)("inlineCode",{parentName:"h2"},"play()")),(0,l.kt)("p",null,"Plays or resumes the current track."),(0,l.kt)("h2",{id:"pause"},(0,l.kt)("inlineCode",{parentName:"h2"},"pause()")),(0,l.kt)("p",null,"Pauses the current track."),(0,l.kt)("h2",{id:"stop"},(0,l.kt)("inlineCode",{parentName:"h2"},"stop()")),(0,l.kt)("p",null,"Stops playback. Behavior is the same as ",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.pause()")," where\n",(0,l.kt)("inlineCode",{parentName:"p"},"playWhenReady")," becomes ",(0,l.kt)("inlineCode",{parentName:"p"},"false"),", but instead of just pausing playback, the item\nis unloaded."),(0,l.kt)("p",null,"This function causes any further loading / buffering to stop."),(0,l.kt)("h2",{id:"retry"},(0,l.kt)("inlineCode",{parentName:"h2"},"retry()")),(0,l.kt)("p",null,"Retries the current track when it stopped playing due to a playback error."),(0,l.kt)("h2",{id:"seekbyoffset"},(0,l.kt)("inlineCode",{parentName:"h2"},"seekBy(offset)")),(0,l.kt)("p",null,"Seeks by a relative time offset in the current track."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"offset"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The offset in seconds")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"seektoseconds"},(0,l.kt)("inlineCode",{parentName:"h2"},"seekTo(seconds)")),(0,l.kt)("p",null,"Seeks to a specified time position in the current track."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"seconds"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The position in seconds")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"setvolumevolume"},(0,l.kt)("inlineCode",{parentName:"h2"},"setVolume(volume)")),(0,l.kt)("p",null,"Sets the volume of the player."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"volume"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The volume in a range from 0 to 1")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"getvolume"},(0,l.kt)("inlineCode",{parentName:"h2"},"getVolume()")),(0,l.kt)("p",null,"Gets the volume of the player (a number between 0 and 1)."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"setraterate"},(0,l.kt)("inlineCode",{parentName:"h2"},"setRate(rate)")),(0,l.kt)("p",null,"Sets the playback rate"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"rate"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The playback rate where 1 is the regular speed")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Note:")," If your rate is high, e.g. above 2, you may want to set the track's ",(0,l.kt)("inlineCode",{parentName:"p"},"pitchAlgorithm")," to something like ",(0,l.kt)("inlineCode",{parentName:"p"},"PitchAlgorithm.Voice"),", or else the default pitch algorithm (which in ",(0,l.kt)("inlineCode",{parentName:"p"},"SwiftAudioEx")," drops down to ",(0,l.kt)("inlineCode",{parentName:"p"},"AVAudioTimePitchAlgorithm.lowQualityZeroLatency"),") will likely\ndrop words in your audio."),(0,l.kt)("h2",{id:"getrate"},(0,l.kt)("inlineCode",{parentName:"h2"},"getRate()")),(0,l.kt)("p",null,"Gets the playback rate, where 1 is the regular speed."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"getprogress"},(0,l.kt)("inlineCode",{parentName:"h2"},"getProgress()")),(0,l.kt)("p",null,"Gets the playback ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/progress"},(0,l.kt)("inlineCode",{parentName:"a"},"Progress"))," of the active track."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/progress"},"Progress"),(0,l.kt)("inlineCode",{parentName:"p"},">")),(0,l.kt)("h2",{id:"getplaybackstate"},(0,l.kt)("inlineCode",{parentName:"h2"},"getPlaybackState()")),(0,l.kt)("p",null,"Gets the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/playback-state"},(0,l.kt)("inlineCode",{parentName:"a"},"PlaybackState"))," of the player."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/playback-state"},"PlaybackState"),(0,l.kt)("inlineCode",{parentName:"p"},">")),(0,l.kt)("h2",{id:"getplaywhenready"},(0,l.kt)("inlineCode",{parentName:"h2"},"getPlayWhenReady()")),(0,l.kt)("p",null,"Gets the current state of ",(0,l.kt)("inlineCode",{parentName:"p"},"playWhenReady"),"."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"setplaywhenreadyplaywhenready"},(0,l.kt)("inlineCode",{parentName:"h2"},"setPlayWhenReady(playWhenReady)")),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.setPlayWhenReady(false)")," is the equivalent of ",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.pause()"),"\nand ",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.setPlayWhenReady(true)")," is the equivalent of\n",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.play()"),"."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"playWhenReady"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"boolean")),(0,l.kt)("td",{parentName:"tr",align:null},"A boolean representing if you want ",(0,l.kt)("inlineCode",{parentName:"td"},"playWhenReady")," set or not.")))),(0,l.kt)("h2",{id:"\ufe0f-getstate"},"\u26a0\ufe0f ",(0,l.kt)("inlineCode",{parentName:"h2"},"getState()")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated")),(0,l.kt)("p",null,"Gets the playback ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/state"},(0,l.kt)("inlineCode",{parentName:"a"},"State"))," of the player."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/state"},"State"),(0,l.kt)("inlineCode",{parentName:"p"},">")),(0,l.kt)("h2",{id:"\ufe0f-getduration"},"\u26a0\ufe0f ",(0,l.kt)("inlineCode",{parentName:"h2"},"getDuration()")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated")),(0,l.kt)("p",null,"Gets the duration of the current track in seconds."),(0,l.kt)("p",null,"Note: ",(0,l.kt)("inlineCode",{parentName:"p"},"react-native-track-player")," is a streaming library, which means it slowly buffers the track and doesn't know exactly when it ends.\nThe duration returned by this function is determined through various tricks and ",(0,l.kt)("em",{parentName:"p"},"may not be exact or may not be available at all"),"."),(0,l.kt)("p",null,"You should only trust the result of this function if you included the ",(0,l.kt)("inlineCode",{parentName:"p"},"duration")," property in the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/track"},"Track Object"),"."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"\ufe0f-getposition"},"\u26a0\ufe0f ",(0,l.kt)("inlineCode",{parentName:"h2"},"getPosition()")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated")),(0,l.kt)("p",null,"Gets the position of the current track in seconds."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"\ufe0f-getbufferedposition"},"\u26a0\ufe0f ",(0,l.kt)("inlineCode",{parentName:"h2"},"getBufferedPosition()")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated")),(0,l.kt)("p",null,"Gets the buffered position of the current track in seconds."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[3179],{3905:function(e,t,n){n.d(t,{Zo:function(){return d},kt:function(){return c}});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),k=s(n),c=r,m=k["".concat(p,".").concat(c)]||k[c]||u[c]||l;return n?a.createElement(m,o(o({ref:t},d),{},{components:n})):a.createElement(m,o({ref:t},d))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=k;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var s=2;ssetupPlayer(options)",id:"setupplayeroptions",level:2},{value:"updateOptions(options)",id:"updateoptionsoptions",level:2},{value:"play()",id:"play",level:2},{value:"pause()",id:"pause",level:2},{value:"stop()",id:"stop",level:2},{value:"retry()",id:"retry",level:2},{value:"seekBy(offset)",id:"seekbyoffset",level:2},{value:"seekTo(seconds)",id:"seektoseconds",level:2},{value:"setVolume(volume)",id:"setvolumevolume",level:2},{value:"getVolume()",id:"getvolume",level:2},{value:"setRate(rate)",id:"setraterate",level:2},{value:"getRate()",id:"getrate",level:2},{value:"getProgress()",id:"getprogress",level:2},{value:"getPlaybackState()",id:"getplaybackstate",level:2},{value:"getPlayWhenReady()",id:"getplaywhenready",level:2},{value:"setPlayWhenReady(playWhenReady)",id:"setplaywhenreadyplaywhenready",level:2},{value:"\u26a0\ufe0f getState()",id:"\ufe0f-getstate",level:2},{value:"\u26a0\ufe0f getDuration()",id:"\ufe0f-getduration",level:2},{value:"\u26a0\ufe0f getPosition()",id:"\ufe0f-getposition",level:2},{value:"\u26a0\ufe0f getBufferedPosition()",id:"\ufe0f-getbufferedposition",level:2}],k={toc:u};function c(e){var t=e.components,n=(0,r.Z)(e,o);return(0,l.kt)("wrapper",(0,a.Z)({},k,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"player"},"Player"),(0,l.kt)("h2",{id:"setupplayeroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"setupPlayer(options)")),(0,l.kt)("p",null,"Accepts a ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/player-options"},(0,l.kt)("inlineCode",{parentName:"a"},"PlayerOptions"))," object."),(0,l.kt)("h2",{id:"updateoptionsoptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"updateOptions(options)")),(0,l.kt)("p",null,"Accepts a ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/update-options"},(0,l.kt)("inlineCode",{parentName:"a"},"UpdateOptions"))," object. Updates\nthe configuration for the components."),(0,l.kt)("p",null,"\u26a0\ufe0f These parameters are different than the ones set using ",(0,l.kt)("inlineCode",{parentName:"p"},"setupPlayer()"),".\nParameters other than those listed below will not be applied."),(0,l.kt)("h2",{id:"play"},(0,l.kt)("inlineCode",{parentName:"h2"},"play()")),(0,l.kt)("p",null,"Plays or resumes the current track."),(0,l.kt)("h2",{id:"pause"},(0,l.kt)("inlineCode",{parentName:"h2"},"pause()")),(0,l.kt)("p",null,"Pauses the current track."),(0,l.kt)("h2",{id:"stop"},(0,l.kt)("inlineCode",{parentName:"h2"},"stop()")),(0,l.kt)("p",null,"Stops playback. Behavior is the same as ",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.pause()")," where\n",(0,l.kt)("inlineCode",{parentName:"p"},"playWhenReady")," becomes ",(0,l.kt)("inlineCode",{parentName:"p"},"false"),", but instead of just pausing playback, the item\nis unloaded."),(0,l.kt)("p",null,"This function causes any further loading / buffering to stop."),(0,l.kt)("h2",{id:"retry"},(0,l.kt)("inlineCode",{parentName:"h2"},"retry()")),(0,l.kt)("p",null,"Retries the current track when it stopped playing due to a playback error."),(0,l.kt)("h2",{id:"seekbyoffset"},(0,l.kt)("inlineCode",{parentName:"h2"},"seekBy(offset)")),(0,l.kt)("p",null,"Seeks by a relative time offset in the current track."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"offset"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The offset in seconds")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"seektoseconds"},(0,l.kt)("inlineCode",{parentName:"h2"},"seekTo(seconds)")),(0,l.kt)("p",null,"Seeks to a specified time position in the current track."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"seconds"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The position in seconds")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"setvolumevolume"},(0,l.kt)("inlineCode",{parentName:"h2"},"setVolume(volume)")),(0,l.kt)("p",null,"Sets the volume of the player."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"volume"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The volume in a range from 0 to 1")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"getvolume"},(0,l.kt)("inlineCode",{parentName:"h2"},"getVolume()")),(0,l.kt)("p",null,"Gets the volume of the player (a number between 0 and 1)."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"setraterate"},(0,l.kt)("inlineCode",{parentName:"h2"},"setRate(rate)")),(0,l.kt)("p",null,"Sets the playback rate"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"rate"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The playback rate where 1 is the regular speed")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Note:")," If your rate is high, e.g. above 2, you may want to set the track's ",(0,l.kt)("inlineCode",{parentName:"p"},"pitchAlgorithm")," to something like ",(0,l.kt)("inlineCode",{parentName:"p"},"PitchAlgorithm.Voice"),", or else the default pitch algorithm (which in ",(0,l.kt)("inlineCode",{parentName:"p"},"SwiftAudioEx")," drops down to ",(0,l.kt)("inlineCode",{parentName:"p"},"AVAudioTimePitchAlgorithm.lowQualityZeroLatency"),") will likely\ndrop words in your audio."),(0,l.kt)("h2",{id:"getrate"},(0,l.kt)("inlineCode",{parentName:"h2"},"getRate()")),(0,l.kt)("p",null,"Gets the playback rate, where 1 is the regular speed."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"getprogress"},(0,l.kt)("inlineCode",{parentName:"h2"},"getProgress()")),(0,l.kt)("p",null,"Gets the playback ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/progress"},(0,l.kt)("inlineCode",{parentName:"a"},"Progress"))," of the active track."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/progress"},"Progress"),(0,l.kt)("inlineCode",{parentName:"p"},">")),(0,l.kt)("h2",{id:"getplaybackstate"},(0,l.kt)("inlineCode",{parentName:"h2"},"getPlaybackState()")),(0,l.kt)("p",null,"Gets the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/playback-state"},(0,l.kt)("inlineCode",{parentName:"a"},"PlaybackState"))," of the player."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/playback-state"},"PlaybackState"),(0,l.kt)("inlineCode",{parentName:"p"},">")),(0,l.kt)("h2",{id:"getplaywhenready"},(0,l.kt)("inlineCode",{parentName:"h2"},"getPlayWhenReady()")),(0,l.kt)("p",null,"Gets the current state of ",(0,l.kt)("inlineCode",{parentName:"p"},"playWhenReady"),"."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"setplaywhenreadyplaywhenready"},(0,l.kt)("inlineCode",{parentName:"h2"},"setPlayWhenReady(playWhenReady)")),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.setPlayWhenReady(false)")," is the equivalent of ",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.pause()"),"\nand ",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.setPlayWhenReady(true)")," is the equivalent of\n",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.play()"),"."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"playWhenReady"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"boolean")),(0,l.kt)("td",{parentName:"tr",align:null},"A boolean representing if you want ",(0,l.kt)("inlineCode",{parentName:"td"},"playWhenReady")," set or not.")))),(0,l.kt)("h2",{id:"\ufe0f-getstate"},"\u26a0\ufe0f ",(0,l.kt)("inlineCode",{parentName:"h2"},"getState()")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated")),(0,l.kt)("p",null,"Gets the playback ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/state"},(0,l.kt)("inlineCode",{parentName:"a"},"State"))," of the player."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/state"},"State"),(0,l.kt)("inlineCode",{parentName:"p"},">")),(0,l.kt)("h2",{id:"\ufe0f-getduration"},"\u26a0\ufe0f ",(0,l.kt)("inlineCode",{parentName:"h2"},"getDuration()")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated")),(0,l.kt)("p",null,"Gets the duration of the current track in seconds."),(0,l.kt)("p",null,"Note: ",(0,l.kt)("inlineCode",{parentName:"p"},"react-native-track-player")," is a streaming library, which means it slowly buffers the track and doesn't know exactly when it ends.\nThe duration returned by this function is determined through various tricks and ",(0,l.kt)("em",{parentName:"p"},"may not be exact or may not be available at all"),"."),(0,l.kt)("p",null,"You should only trust the result of this function if you included the ",(0,l.kt)("inlineCode",{parentName:"p"},"duration")," property in the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/track"},"Track Object"),"."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"\ufe0f-getposition"},"\u26a0\ufe0f ",(0,l.kt)("inlineCode",{parentName:"h2"},"getPosition()")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated")),(0,l.kt)("p",null,"Gets the position of the current track in seconds."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"\ufe0f-getbufferedposition"},"\u26a0\ufe0f ",(0,l.kt)("inlineCode",{parentName:"h2"},"getBufferedPosition()")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated")),(0,l.kt)("p",null,"Gets the buffered position of the current track in seconds."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d6713ad4.f21f37cf.js b/assets/js/05dd9f1b.90e84b08.js similarity index 94% rename from assets/js/d6713ad4.f21f37cf.js rename to assets/js/05dd9f1b.90e84b08.js index 620a539df..e4d3af579 100644 --- a/assets/js/d6713ad4.f21f37cf.js +++ b/assets/js/05dd9f1b.90e84b08.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[8089],{3905:function(e,n,t){t.d(n,{Zo:function(){return l},kt:function(){return m}});var r=t(7294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),u=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},l=function(e){var n=u(e.components);return r.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),p=u(t),m=o,f=p["".concat(c,".").concat(m)]||p[m]||d[m]||a;return t?r.createElement(f,i(i({ref:n},l),{},{components:t})):r.createElement(f,i({ref:n},l))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=p;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var u=2;u {\n+ async function add(tracks: Track | Track[], insertBeforeIndex?: number): Promise {\n\n- async function remove(tracks: string | string[]): Promise {\n+ async function remove(tracks: number | number[]): Promise {\n\n- async function skip(trackId: string): Promise {\n+ function skip(trackIndex: number): Promise {\n\n- async function updateMetadataForTrack(trackId: string, metadata: TrackMetadataBase): Promise {\n+ async function updateMetadataForTrack(trackIndex: number, metadata: TrackMetadataBase): Promise {\n\n- async function getTrack(trackId: string): Promise {\n+ async function getTrack(trackIndex: number): Promise {\n\n- async function getCurrentTrack(): Promise {\n+ async function getCurrentTrack(): Promise {\n\n// Imports\n\nimport TrackPlayer, {\n- STATE_XXX,\n- CAPABILITY_XXX,\n- PITCH_ALGORITHM_XXX,\n- RATING_XXX,\n+ State,\n+ Capability,\n+ PitchAlgorithm,\n+ RatingType,\n+ Event,\n+ RepeatMode\n} from 'react-native-track-player'\n\n// Hooks\n\n- useTrackPlayerProgress\n+ useProgress\n\n// Event Listeners\n// Refrain from using: TrackPlayer.addEventListener() and instead use the provided hooks\n\n+ usePlaybackState\n+ useTrackPlayerEvents\n+ useProgress\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[5605],{3905:function(e,n,t){t.d(n,{Zo:function(){return l},kt:function(){return m}});var r=t(7294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),u=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},l=function(e){var n=u(e.components);return r.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),p=u(t),m=o,f=p["".concat(c,".").concat(m)]||p[m]||d[m]||a;return t?r.createElement(f,i(i({ref:n},l),{},{components:t})):r.createElement(f,i({ref:n},l))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=p;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var u=2;u {\n+ async function add(tracks: Track | Track[], insertBeforeIndex?: number): Promise {\n\n- async function remove(tracks: string | string[]): Promise {\n+ async function remove(tracks: number | number[]): Promise {\n\n- async function skip(trackId: string): Promise {\n+ function skip(trackIndex: number): Promise {\n\n- async function updateMetadataForTrack(trackId: string, metadata: TrackMetadataBase): Promise {\n+ async function updateMetadataForTrack(trackIndex: number, metadata: TrackMetadataBase): Promise {\n\n- async function getTrack(trackId: string): Promise {\n+ async function getTrack(trackIndex: number): Promise {\n\n- async function getCurrentTrack(): Promise {\n+ async function getCurrentTrack(): Promise {\n\n// Imports\n\nimport TrackPlayer, {\n- STATE_XXX,\n- CAPABILITY_XXX,\n- PITCH_ALGORITHM_XXX,\n- RATING_XXX,\n+ State,\n+ Capability,\n+ PitchAlgorithm,\n+ RatingType,\n+ Event,\n+ RepeatMode\n} from 'react-native-track-player'\n\n// Hooks\n\n- useTrackPlayerProgress\n+ useProgress\n\n// Event Listeners\n// Refrain from using: TrackPlayer.addEventListener() and instead use the provided hooks\n\n+ usePlaybackState\n+ useTrackPlayerEvents\n+ useProgress\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/07004238.2160200e.js b/assets/js/07004238.2160200e.js new file mode 100644 index 000000000..4b824040b --- /dev/null +++ b/assets/js/07004238.2160200e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[7950],{3905:function(e,r,n){n.d(r,{Zo:function(){return l},kt:function(){return g}});var t=n(7294);function o(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=t.createContext({}),c=function(e){var r=t.useContext(p),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},l=function(e){var r=c(e.components);return t.createElement(p.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},d=t.forwardRef((function(e,r){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=c(n),g=o,h=d["".concat(p,".").concat(g)]||d[g]||u[g]||a;return n?t.createElement(h,s(s({ref:r},l),{},{components:n})):t.createElement(h,s({ref:r},l))}));function g(e,r){var n=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=d;var i={};for(var p in r)hasOwnProperty.call(r,p)&&(i[p]=r[p]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var c=2;c App);")," in your ",(0,a.kt)("inlineCode",{parentName:"p"},"index.js")," file)\n",(0,a.kt)("strong",{parentName:"p"},"WILL NOT EXECUTE"),"."),(0,a.kt)("p",null,"In a nutshell, if you do this, you're progress ",(0,a.kt)("strong",{parentName:"p"},"will not")," update when the user\nis playing back in Remote contexts and therefore your app will seem buggy."),(0,a.kt)("h2",{id:"recommended-approach"},"Recommended Approach"),(0,a.kt)("p",null,"The correct way to handle this is to track progress in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/4.0/basics/playback-service"},"Playback Service"),", based on the\n",(0,a.kt)("inlineCode",{parentName:"p"},"Event.PlaybackProgressUpdated")," event. These events fire all the time, including\nwhen your app is playing back remotely."))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e898bf59.6b2b83b2.js b/assets/js/0714762b.5a6ebbf6.js similarity index 91% rename from assets/js/e898bf59.6b2b83b2.js rename to assets/js/0714762b.5a6ebbf6.js index 2e7800da8..7f83c754f 100644 --- a/assets/js/e898bf59.6b2b83b2.js +++ b/assets/js/0714762b.5a6ebbf6.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1695],{3905:function(e,t,n){n.d(t,{Zo:function(){return s},kt:function(){return m}});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(f,i(i({ref:t},s),{},{components:n})):r.createElement(f,i({ref:t},s))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p.mdxType="string"==typeof e?e:a,i[1]=p;for(var c=2;c=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(f,i(i({ref:t},s),{},{components:n})):r.createElement(f,i({ref:t},s))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p.mdxType="string"==typeof e?e:a,i[1]=p;for(var c=2;c=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),d=p(n),f=a,m=d["".concat(l,".").concat(f)]||d[f]||s[f]||o;return n?r.createElement(m,i(i({ref:t},u),{},{components:n})):r.createElement(m,i({ref:t},u))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var p=2;p=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),d=p(n),f=a,m=d["".concat(l,".").concat(f)]||d[f]||s[f]||o;return n?r.createElement(m,i(i({ref:t},u),{},{components:n})):r.createElement(m,i({ref:t},u))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var p=2;p=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),d=p(n),f=a,m=d["".concat(l,".").concat(f)]||d[f]||s[f]||o;return n?r.createElement(m,i(i({ref:t},u),{},{components:n})):r.createElement(m,i({ref:t},u))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var p=2;p=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}var c=a.createContext({}),d=function(e){var t=a.useContext(c),o=t;return e&&(o="function"==typeof e?e(t):r(r({},t),e)),o},l=function(e){var t=d(e.components);return a.createElement(c.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var o=e.components,n=e.mdxType,i=e.originalType,c=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),u=d(o),m=n,h=u["".concat(c,".").concat(m)]||u[m]||s[m]||i;return o?a.createElement(h,r(r({ref:t},l),{},{components:o})):a.createElement(h,r({ref:t},l))}));function m(e,t){var o=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=o.length,r=new Array(i);r[0]=u;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p.mdxType="string"==typeof e?e:n,r[1]=p;for(var d=2;dDefault",id:"default",level:2},{value:"GameChat",id:"gamechat",level:2},{value:"Measurement",id:"measurement",level:2},{value:"MoviePlayback",id:"movieplayback",level:2},{value:"SpokenAudio",id:"spokenaudio",level:2},{value:"VideoChat",id:"videochat",level:2},{value:"VideoRecording",id:"videorecording",level:2},{value:"VoiceChat",id:"voicechat",level:2},{value:"VoicePrompt",id:"voiceprompt",level:2}],u={toc:s};function m(e){var t=e.components,o=(0,n.Z)(e,r);return(0,i.kt)("wrapper",(0,a.Z)({},u,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"ios-category-mode-ios-only"},"iOS Category Mode (ios-only)"),(0,i.kt)("p",null,"All iOS Category Mode types are made available through the named export ",(0,i.kt)("inlineCode",{parentName:"p"},"IOSCategoryMode"),":"),(0,i.kt)("h2",{id:"default"},(0,i.kt)("inlineCode",{parentName:"h2"},"Default")),(0,i.kt)("p",null,"The default audio session mode."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616579-default"},"See the Apple Docs")),(0,i.kt)("h2",{id:"gamechat"},(0,i.kt)("inlineCode",{parentName:"h2"},"GameChat")),(0,i.kt)("p",null,"A mode that the GameKit framework sets on behalf of an application that\nuses GameKit\u2019s voice chat service."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616511-gamechat"},"See the Apple Docs")),(0,i.kt)("h2",{id:"measurement"},(0,i.kt)("inlineCode",{parentName:"h2"},"Measurement")),(0,i.kt)("p",null,"A mode that indicates that your app is performing measurement of audio\ninput or output."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616608-measurement"},"See the Apple Docs")),(0,i.kt)("h2",{id:"movieplayback"},(0,i.kt)("inlineCode",{parentName:"h2"},"MoviePlayback")),(0,i.kt)("p",null,"A mode that indicates that your app is playing back movie content."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616623-movieplayback"},"See the Apple Docs")),(0,i.kt)("h2",{id:"spokenaudio"},(0,i.kt)("inlineCode",{parentName:"h2"},"SpokenAudio")),(0,i.kt)("p",null,"A mode used for continuous spoken audio to pause the audio when another\napp plays a short audio prompt."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616510-spokenaudio"},"See the Apple Docs")),(0,i.kt)("h2",{id:"videochat"},(0,i.kt)("inlineCode",{parentName:"h2"},"VideoChat")),(0,i.kt)("p",null,"A mode that indicates that your app is engaging in online video conferencing."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616590-videochat"},"See the Apple Docs")),(0,i.kt)("h2",{id:"videorecording"},(0,i.kt)("inlineCode",{parentName:"h2"},"VideoRecording")),(0,i.kt)("p",null,"A mode that indicates that your app is recording a movie."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616535-videorecording"},"See the Apple Docs")),(0,i.kt)("h2",{id:"voicechat"},(0,i.kt)("inlineCode",{parentName:"h2"},"VoiceChat")),(0,i.kt)("p",null,"A mode that indicates that your app is performing two-way voice communication,\nsuch as using Voice over Internet Protocol (VoIP)."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616455-voicechat"},"See the Apple Docs")),(0,i.kt)("h2",{id:"voiceprompt"},(0,i.kt)("inlineCode",{parentName:"h2"},"VoicePrompt")),(0,i.kt)("p",null,"A mode that indicates that your app plays audio using text-to-speech."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/2962803-voiceprompt"},"See the Apple Docs")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/12770ebd.98267b44.js b/assets/js/12770ebd.98267b44.js deleted file mode 100644 index 31e3c5312..000000000 --- a/assets/js/12770ebd.98267b44.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[9629],{3905:function(e,t,n){n.d(t,{Zo:function(){return p},kt:function(){return d}});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),f=s(n),d=o,y=f["".concat(c,".").concat(d)]||f[d]||u[d]||a;return n?r.createElement(y,i(i({ref:t},p),{},{components:n})):r.createElement(y,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var s=2;s=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),f=s(n),d=o,y=f["".concat(c,".").concat(d)]||f[d]||u[d]||a;return n?r.createElement(y,i(i({ref:t},p),{},{components:n})):r.createElement(y,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var s=2;s=0||(i[a]=t[a]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(i[a]=t[a])}return i}var p=n.createContext({}),d=function(t){var e=n.useContext(p),a=e;return t&&(a="function"==typeof t?t(e):l(l({},e),t)),a},c=function(t){var e=d(t.components);return n.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},u=n.forwardRef((function(t,e){var a=t.components,i=t.mdxType,r=t.originalType,p=t.parentName,c=o(t,["components","mdxType","originalType","parentName"]),u=d(a),s=i,y=u["".concat(p,".").concat(s)]||u[s]||m[s]||r;return a?n.createElement(y,l(l({ref:e},c),{},{components:a})):n.createElement(y,l({ref:e},c))}));function s(t,e){var a=arguments,i=e&&e.mdxType;if("string"==typeof t||i){var r=a.length,l=new Array(r);l[0]=u;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:i,l[1]=o;for(var d=2;d=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(n),k=a,m=d["".concat(l,".").concat(k)]||d[k]||u[k]||o;return n?r.createElement(m,i(i({ref:t},p),{},{components:n})):r.createElement(m,i({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var c=2;cuseTrackPlayerEvents",id:"usetrackplayerevents",level:2},{value:"useProgress",id:"useprogress",level:2},{value:"usePlaybackState",id:"useplaybackstate",level:2},{value:"usePlayWhenReady",id:"useplaywhenready",level:2},{value:"useActiveTrack",id:"useactivetrack",level:2}],d={toc:u};function k(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"hooks"},"Hooks"),(0,o.kt)("p",null,"React v16.8 introduced ",(0,o.kt)("a",{parentName:"p",href:"https://reactjs.org/docs/hooks-intro.html"},"hooks"),". If you are using a version of React Native that is before ",(0,o.kt)("a",{parentName:"p",href:"https://reactnative.dev/blog/2019/03/12/releasing-react-native-059"},"v0.59.0"),", your React Native version does not support hooks."),(0,o.kt)("h2",{id:"usetrackplayerevents"},(0,o.kt)("inlineCode",{parentName:"h2"},"useTrackPlayerEvents")),(0,o.kt)("p",null,"Register an event listener for one or more of the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/events"},"events")," emitted by the TrackPlayer. The subscription is removed when the component unmounts."),(0,o.kt)("p",null,"Check out the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/events"},"events section")," for a full list of supported events."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { useTrackPlayerEvents, Event, State } from 'react-native-track-player';\n\n// Subscribing to the following events inside MyComponent\nconst events = [\n Event.PlaybackState,\n Event.PlaybackError,\n];\n\nconst MyComponent = () => {\n const [playerState, setPlayerState] = useState(null)\n\n useTrackPlayerEvents(events, (event) => {\n if (event.type === Event.PlaybackError) {\n console.warn('An error occured while playing the current track.');\n }\n if (event.type === Event.PlaybackState) {\n setPlayerState(event.state);\n }\n });\n\n const isPlaying = playerState === State.Playing;\n\n return (\n \n The TrackPlayer is {isPlaying ? 'playing' : 'not playing'}\n \n );\n};\n")),(0,o.kt)("h2",{id:"useprogress"},(0,o.kt)("inlineCode",{parentName:"h2"},"useProgress")),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"State"),(0,o.kt)("th",{parentName:"tr",align:null},"Type"),(0,o.kt)("th",{parentName:"tr",align:null},"Description"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"position"),(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"number")),(0,o.kt)("td",{parentName:"tr",align:null},"The current position in seconds")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"buffered"),(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"number")),(0,o.kt)("td",{parentName:"tr",align:null},"The buffered position in seconds")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"duration"),(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"number")),(0,o.kt)("td",{parentName:"tr",align:null},"The duration in seconds")))),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"useProgress")," accepts an interval to set the rate (in miliseconds) to poll the track player's progress. The default value is ",(0,o.kt)("inlineCode",{parentName:"p"},"1000")," or every second."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import React from 'react';\nimport { Text, View } from 'react-native';\nimport { useProgress } from 'react-native-track-player';\n\nconst MyComponent = () => {\n const { position, buffered, duration } = useProgress()\n\n return (\n \n Track progress: {position} seconds out of {duration} total\n Buffered progress: {buffered} seconds buffered out of {duration} total\n \n )\n}\n")),(0,o.kt)("h2",{id:"useplaybackstate"},(0,o.kt)("inlineCode",{parentName:"h2"},"usePlaybackState")),(0,o.kt)("p",null,"A hook which returns the up to date state of ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/functions/player#getplaybackstate"},(0,o.kt)("inlineCode",{parentName:"a"},"getPlaybackState()")),".\nThe hook will initially return ",(0,o.kt)("inlineCode",{parentName:"p"},"{ state: undefined }")," while it is awaiting the\ninitial state of the player."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { usePlaybackState, State } from 'react-native-track-player';\n\nconst MyComponent = () => {\n const playerState = usePlaybackState();\n const isPlaying = playerState === State.Playing;\n\n return (\n \n The TrackPlayer is {isPlaying ? 'playing' : 'not playing'}\n \n );\n};\n")),(0,o.kt)("h2",{id:"useplaywhenready"},(0,o.kt)("inlineCode",{parentName:"h2"},"usePlayWhenReady")),(0,o.kt)("p",null,"A hook which returns the up to date state of ",(0,o.kt)("inlineCode",{parentName:"p"},"TrackPlayer.getPlayWhenReady()"),"."),(0,o.kt)("h2",{id:"useactivetrack"},(0,o.kt)("inlineCode",{parentName:"h2"},"useActiveTrack")),(0,o.kt)("p",null,"A hook which keeps track of the currently active track using\n",(0,o.kt)("inlineCode",{parentName:"p"},"TrackPlayer.getActiveTrack()")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Event.PlaybackActiveTrackChanged"),"."))}k.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[3472],{3905:function(e,t,n){n.d(t,{Zo:function(){return p},kt:function(){return k}});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(n),k=a,m=d["".concat(l,".").concat(k)]||d[k]||u[k]||o;return n?r.createElement(m,i(i({ref:t},p),{},{components:n})):r.createElement(m,i({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var c=2;cuseTrackPlayerEvents",id:"usetrackplayerevents",level:2},{value:"useProgress",id:"useprogress",level:2},{value:"usePlaybackState",id:"useplaybackstate",level:2},{value:"usePlayWhenReady",id:"useplaywhenready",level:2},{value:"useActiveTrack",id:"useactivetrack",level:2}],d={toc:u};function k(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"hooks"},"Hooks"),(0,o.kt)("p",null,"React v16.8 introduced ",(0,o.kt)("a",{parentName:"p",href:"https://reactjs.org/docs/hooks-intro.html"},"hooks"),". If you are using a version of React Native that is before ",(0,o.kt)("a",{parentName:"p",href:"https://reactnative.dev/blog/2019/03/12/releasing-react-native-059"},"v0.59.0"),", your React Native version does not support hooks."),(0,o.kt)("h2",{id:"usetrackplayerevents"},(0,o.kt)("inlineCode",{parentName:"h2"},"useTrackPlayerEvents")),(0,o.kt)("p",null,"Register an event listener for one or more of the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/events"},"events")," emitted by the TrackPlayer. The subscription is removed when the component unmounts."),(0,o.kt)("p",null,"Check out the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/events"},"events section")," for a full list of supported events."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { useTrackPlayerEvents, Event, State } from 'react-native-track-player';\n\n// Subscribing to the following events inside MyComponent\nconst events = [\n Event.PlaybackState,\n Event.PlaybackError,\n];\n\nconst MyComponent = () => {\n const [playerState, setPlayerState] = useState(null)\n\n useTrackPlayerEvents(events, (event) => {\n if (event.type === Event.PlaybackError) {\n console.warn('An error occured while playing the current track.');\n }\n if (event.type === Event.PlaybackState) {\n setPlayerState(event.state);\n }\n });\n\n const isPlaying = playerState === State.Playing;\n\n return (\n \n The TrackPlayer is {isPlaying ? 'playing' : 'not playing'}\n \n );\n};\n")),(0,o.kt)("h2",{id:"useprogress"},(0,o.kt)("inlineCode",{parentName:"h2"},"useProgress")),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"State"),(0,o.kt)("th",{parentName:"tr",align:null},"Type"),(0,o.kt)("th",{parentName:"tr",align:null},"Description"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"position"),(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"number")),(0,o.kt)("td",{parentName:"tr",align:null},"The current position in seconds")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"buffered"),(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"number")),(0,o.kt)("td",{parentName:"tr",align:null},"The buffered position in seconds")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"duration"),(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"number")),(0,o.kt)("td",{parentName:"tr",align:null},"The duration in seconds")))),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"useProgress")," accepts an interval to set the rate (in miliseconds) to poll the track player's progress. The default value is ",(0,o.kt)("inlineCode",{parentName:"p"},"1000")," or every second."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import React from 'react';\nimport { Text, View } from 'react-native';\nimport { useProgress } from 'react-native-track-player';\n\nconst MyComponent = () => {\n const { position, buffered, duration } = useProgress()\n\n return (\n \n Track progress: {position} seconds out of {duration} total\n Buffered progress: {buffered} seconds buffered out of {duration} total\n \n )\n}\n")),(0,o.kt)("h2",{id:"useplaybackstate"},(0,o.kt)("inlineCode",{parentName:"h2"},"usePlaybackState")),(0,o.kt)("p",null,"A hook which returns the up to date state of ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/functions/player#getplaybackstate"},(0,o.kt)("inlineCode",{parentName:"a"},"getPlaybackState()")),".\nThe hook will initially return ",(0,o.kt)("inlineCode",{parentName:"p"},"{ state: undefined }")," while it is awaiting the\ninitial state of the player."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { usePlaybackState, State } from 'react-native-track-player';\n\nconst MyComponent = () => {\n const playerState = usePlaybackState();\n const isPlaying = playerState === State.Playing;\n\n return (\n \n The TrackPlayer is {isPlaying ? 'playing' : 'not playing'}\n \n );\n};\n")),(0,o.kt)("h2",{id:"useplaywhenready"},(0,o.kt)("inlineCode",{parentName:"h2"},"usePlayWhenReady")),(0,o.kt)("p",null,"A hook which returns the up to date state of ",(0,o.kt)("inlineCode",{parentName:"p"},"TrackPlayer.getPlayWhenReady()"),"."),(0,o.kt)("h2",{id:"useactivetrack"},(0,o.kt)("inlineCode",{parentName:"h2"},"useActiveTrack")),(0,o.kt)("p",null,"A hook which keeps track of the currently active track using\n",(0,o.kt)("inlineCode",{parentName:"p"},"TrackPlayer.getActiveTrack()")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Event.PlaybackActiveTrackChanged"),"."))}k.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1925e818.f443cbde.js b/assets/js/1925e818.f443cbde.js new file mode 100644 index 000000000..557ab965d --- /dev/null +++ b/assets/js/1925e818.f443cbde.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[8705],{3905:function(e,t,n){n.d(t,{Zo:function(){return p},kt:function(){return m}});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),s=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return a.createElement(u.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,u=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,b=d["".concat(u,".").concat(m)]||d[m]||c[m]||l;return n?a.createElement(b,i(i({ref:t},p),{},{components:n})):a.createElement(b,i({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=d;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var s=2;s child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})),v=null!=d?d:f.map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes}})),y=(0,i.lx)(v,(function(e,t){return e.value===t.value}));if(y.length>0)throw new Error('Docusaurus error: Duplicate values "'+y.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.');var h=null===c?c:null!=(t=null!=c?c:null==(n=f.find((function(e){return e.props.default})))?void 0:n.props.value)?t:null==(l=f[0])?void 0:l.props.value;if(null!==h&&!v.some((function(e){return e.value===h})))throw new Error('Docusaurus error: The has a defaultValue "'+h+'" but none of its children has the corresponding value. Available values are: '+v.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");var k=(0,i.UB)(),g=k.tabGroupChoices,w=k.setTabGroupChoices,T=(0,r.useState)(h),N=T[0],x=T[1],O=[],E=(0,i.o5)().blockElementScrollPositionUntilNextRender;if(null!=m){var I=g[m];null!=I&&I!==N&&v.some((function(e){return e.value===I}))&&x(I)}var S=function(e){var t=e.currentTarget,n=O.indexOf(t),a=v[n].value;a!==N&&(E(t),x(a),null!=m&&w(m,a))},P=function(e){var t,n=null;switch(e.key){case"ArrowRight":var a=O.indexOf(e.currentTarget)+1;n=O[a]||O[0];break;case"ArrowLeft":var r=O.indexOf(e.currentTarget)-1;n=O[r]||O[O.length-1]}null==(t=n)||t.focus()};return r.createElement("div",{className:"tabs-container"},r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":p},b)},v.map((function(e){var t=e.value,n=e.label,l=e.attributes;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:N===t?0:-1,"aria-selected":N===t,key:t,ref:function(e){return O.push(e)},onKeyDown:P,onFocus:S,onClick:S},l,{className:(0,o.Z)("tabs__item",u,null==l?void 0:l.className,{"tabs__item--active":N===t})}),null!=n?n:t)}))),s?(0,r.cloneElement)(f.filter((function(e){return e.props.value===N}))[0],{className:"margin-vert--md"}):r.createElement("div",{className:"margin-vert--md"},f.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==N})}))))}function p(e){var t=(0,l.Z)();return r.createElement(s,(0,a.Z)({key:String(t)},e))}},8824:function(e,t,n){n.r(t),n.d(t,{assets:function(){return d},contentTitle:function(){return p},default:function(){return f},frontMatter:function(){return s},metadata:function(){return c},toc:function(){return m}});var a=n(7462),r=n(3366),l=(n(7294),n(3905)),i=n(9877),o=n(8215),u=["components"],s={sidebar_position:1},p="Installation",c={unversionedId:"basics/installation",id:"version-4.1/basics/installation",title:"Installation",description:"Stable",source:"@site/versioned_docs/version-4.1/basics/installation.mdx",sourceDirName:"basics",slug:"/basics/installation",permalink:"/docs/basics/installation",editUrl:"https://github.com/doublesymmetry/react-native-track-player/tree/main/docs/versioned_docs/version-4.1/basics/installation.mdx",tags:[],version:"4.1",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"app",previous:{title:"Intro",permalink:"/docs/intro"},next:{title:"Getting Started",permalink:"/docs/basics/getting-started"}},d={},m=[{value:"Stable",id:"stable",level:2},{value:"Unstable / Nightly",id:"unstable--nightly",level:2},{value:"iOS Setup",id:"ios-setup",level:2},{value:"Enable Swift Modules",id:"enable-swift-modules",level:3},{value:"Pod Install",id:"pod-install",level:3},{value:"Web Setup",id:"web-setup",level:2},{value:"Expo",id:"expo",level:2}],b={toc:m};function f(e){var t=e.components,n=(0,r.Z)(e,u);return(0,l.kt)("wrapper",(0,a.Z)({},b,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"installation"},"Installation"),(0,l.kt)("h2",{id:"stable"},"Stable"),(0,l.kt)(i.Z,{groupId:"pkg",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"npm",label:"NPM",default:!0,mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"npm install --save react-native-track-player\n"))),(0,l.kt)(o.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"yarn add react-native-track-player\n")))),(0,l.kt)("h2",{id:"unstable--nightly"},"Unstable / Nightly"),(0,l.kt)("p",null,"If for some reason you require an update that has not yet been officially\nreleased you can install the ",(0,l.kt)("inlineCode",{parentName:"p"},"nightly")," version which is an automatic release of\n",(0,l.kt)("inlineCode",{parentName:"p"},"main")," published to npm every 24hrs."),(0,l.kt)(i.Z,{groupId:"pkg",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"npm",label:"NPM",default:!0,mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"npm install --save react-native-track-player@nightly\n"))),(0,l.kt)(o.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"yarn add react-native-track-player@nightly\n")))),(0,l.kt)("h2",{id:"ios-setup"},"iOS Setup"),(0,l.kt)("p",null,"iOS requires a few extra steps that are ",(0,l.kt)("em",{parentName:"p"},"not")," required for Android/Web."),(0,l.kt)("h3",{id:"enable-swift-modules"},"Enable Swift Modules"),(0,l.kt)("p",null,"Because the iOS module uses Swift, if the user is using a standard react-native application they'll need to add support for Swift in the project. This can be easily by adding a swift file to the Xcode project -- could be called ",(0,l.kt)("inlineCode",{parentName:"p"},"dummy.swift")," and saying yes when prompted if you'd like to generate a bridging header."),(0,l.kt)("p",null,(0,l.kt)("img",{parentName:"p",src:"https://i.imgur.com/CBqBcWs.png",alt:"Importing Swift"})),(0,l.kt)("h3",{id:"pod-install"},"Pod Install"),(0,l.kt)("p",null,"You'll need to run a ",(0,l.kt)("inlineCode",{parentName:"p"},"pod install")," in order to install the native iOS dependencies"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"cd ios && pod install\n")),(0,l.kt)("h2",{id:"web-setup"},"Web Setup"),(0,l.kt)("p",null,"RNTP is available on web. The web implementation leverages ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/shaka-project/shaka-player"},"shaka-player"),"\nwhich is an optional peer dependency of the RNTP. If you want to deploy the web\nplatform you'll need to install ",(0,l.kt)("inlineCode",{parentName:"p"},"shaka-player")," directly in your project:"),(0,l.kt)(i.Z,{groupId:"pkg",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"npm",label:"NPM",default:!0,mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"npm install --save shaka-player\n"))),(0,l.kt)(o.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"yarn add shaka-player\n")))),(0,l.kt)("p",null,"You may need to ",(0,l.kt)("a",{parentName:"p",href:"/docs/troubleshooting#web-issues-with-hls-streams"},"enable transmuxing support"),"\nif you're using HLS streams with MPEG2-TS content."),(0,l.kt)(i.Z,{groupId:"pkg",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"npm",label:"NPM",default:!0,mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"npm install --save mux.js\n"))),(0,l.kt)(o.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"yarn add mux.js\n")))),(0,l.kt)("h2",{id:"expo"},"Expo"),(0,l.kt)("p",null,"You can now use React Native Track Player with Expo. "),(0,l.kt)("p",null,"Please be aware that while many people are using React Native Track Player with Expo successfully, the current maintainers of this project do not use Expo and their ability to resolve issues involving Expo is limited."),(0,l.kt)("p",null,"To get started, create a ",(0,l.kt)("a",{parentName:"p",href:"https://docs.expo.dev/clients/getting-started/"},"custom development client")," for your Expo app and then install React Native Track Player."),(0,l.kt)("p",null,"Here is the configuration required for audio playback in background:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://docs.expo.dev/versions/latest/sdk/audio/#playing-or-recording-audio-in-background"},"iOS: Enable audio playback in background via your app.json")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"/docs/basics/background-mode/#android"},"Android: Stop playback when the app is closed"))))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1977677a.152afdca.js b/assets/js/1977677a.152afdca.js new file mode 100644 index 000000000..d5e16df1c --- /dev/null +++ b/assets/js/1977677a.152afdca.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[6804],{3905:function(e,t,r){r.d(t,{Zo:function(){return u},kt:function(){return b}});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),d=p(r),b=a,m=d["".concat(l,".").concat(b)]||d[b]||s[b]||o;return r?n.createElement(m,i(i({ref:t},u),{},{components:r})):n.createElement(m,i({ref:t},u))}));function b(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var p=2;p=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),d=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=d(e.components);return r.createElement(p.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=d(n),m=a,f=u["".concat(p,".").concat(m)]||u[m]||s[m]||o;return n?r.createElement(f,i(i({ref:t},c),{},{components:n})):r.createElement(f,i({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var d=2;d=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),d=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=d(e.components);return r.createElement(p.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=d(n),m=a,f=u["".concat(p,".").concat(m)]||u[m]||s[m]||o;return n?r.createElement(f,i(i({ref:t},c),{},{components:n})):r.createElement(f,i({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var d=2;d=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),k=s(n),c=r,m=k["".concat(p,".").concat(c)]||k[c]||u[c]||l;return n?a.createElement(m,o(o({ref:t},d),{},{components:n})):a.createElement(m,o({ref:t},d))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=k;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var s=2;ssetupPlayer(options)",id:"setupplayeroptions",level:2},{value:"updateOptions(options)",id:"updateoptionsoptions",level:2},{value:"play()",id:"play",level:2},{value:"pause()",id:"pause",level:2},{value:"stop()",id:"stop",level:2},{value:"retry()",id:"retry",level:2},{value:"seekBy(offset)",id:"seekbyoffset",level:2},{value:"seekTo(seconds)",id:"seektoseconds",level:2},{value:"setVolume(volume)",id:"setvolumevolume",level:2},{value:"getVolume()",id:"getvolume",level:2},{value:"setRate(rate)",id:"setraterate",level:2},{value:"getRate()",id:"getrate",level:2},{value:"getProgress()",id:"getprogress",level:2},{value:"getPlaybackState()",id:"getplaybackstate",level:2},{value:"getPlayWhenReady()",id:"getplaywhenready",level:2},{value:"setPlayWhenReady(playWhenReady)",id:"setplaywhenreadyplaywhenready",level:2},{value:"\u26a0\ufe0f getState()",id:"\ufe0f-getstate",level:2},{value:"\u26a0\ufe0f getDuration()",id:"\ufe0f-getduration",level:2},{value:"\u26a0\ufe0f getPosition()",id:"\ufe0f-getposition",level:2},{value:"\u26a0\ufe0f getBufferedPosition()",id:"\ufe0f-getbufferedposition",level:2}],k={toc:u};function c(e){var t=e.components,n=(0,r.Z)(e,o);return(0,l.kt)("wrapper",(0,a.Z)({},k,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"player"},"Player"),(0,l.kt)("h2",{id:"setupplayeroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"setupPlayer(options)")),(0,l.kt)("p",null,"Accepts a ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/player-options"},(0,l.kt)("inlineCode",{parentName:"a"},"PlayerOptions"))," object."),(0,l.kt)("h2",{id:"updateoptionsoptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"updateOptions(options)")),(0,l.kt)("p",null,"Accepts a ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/update-options"},(0,l.kt)("inlineCode",{parentName:"a"},"UpdateOptions"))," object. Updates\nthe configuration for the components."),(0,l.kt)("p",null,"\u26a0\ufe0f These parameters are different than the ones set using ",(0,l.kt)("inlineCode",{parentName:"p"},"setupPlayer()"),".\nParameters other than those listed below will not be applied."),(0,l.kt)("h2",{id:"play"},(0,l.kt)("inlineCode",{parentName:"h2"},"play()")),(0,l.kt)("p",null,"Plays or resumes the current track."),(0,l.kt)("h2",{id:"pause"},(0,l.kt)("inlineCode",{parentName:"h2"},"pause()")),(0,l.kt)("p",null,"Pauses the current track."),(0,l.kt)("h2",{id:"stop"},(0,l.kt)("inlineCode",{parentName:"h2"},"stop()")),(0,l.kt)("p",null,"Stops playback. Behavior is the same as ",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.pause()")," where\n",(0,l.kt)("inlineCode",{parentName:"p"},"playWhenReady")," becomes ",(0,l.kt)("inlineCode",{parentName:"p"},"false"),", but instead of just pausing playback, the item\nis unloaded."),(0,l.kt)("p",null,"This function causes any further loading / buffering to stop."),(0,l.kt)("h2",{id:"retry"},(0,l.kt)("inlineCode",{parentName:"h2"},"retry()")),(0,l.kt)("p",null,"Retries the current track when it stopped playing due to a playback error."),(0,l.kt)("h2",{id:"seekbyoffset"},(0,l.kt)("inlineCode",{parentName:"h2"},"seekBy(offset)")),(0,l.kt)("p",null,"Seeks by a relative time offset in the current track."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"offset"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The offset in seconds")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"seektoseconds"},(0,l.kt)("inlineCode",{parentName:"h2"},"seekTo(seconds)")),(0,l.kt)("p",null,"Seeks to a specified time position in the current track."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"seconds"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The position in seconds")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"setvolumevolume"},(0,l.kt)("inlineCode",{parentName:"h2"},"setVolume(volume)")),(0,l.kt)("p",null,"Sets the volume of the player."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"volume"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The volume in a range from 0 to 1")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"getvolume"},(0,l.kt)("inlineCode",{parentName:"h2"},"getVolume()")),(0,l.kt)("p",null,"Gets the volume of the player (a number between 0 and 1)."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"setraterate"},(0,l.kt)("inlineCode",{parentName:"h2"},"setRate(rate)")),(0,l.kt)("p",null,"Sets the playback rate"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"rate"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The playback rate where 1 is the regular speed")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Note:")," If your rate is high, e.g. above 2, you may want to set the track's ",(0,l.kt)("inlineCode",{parentName:"p"},"pitchAlgorithm")," to something like ",(0,l.kt)("inlineCode",{parentName:"p"},"PitchAlgorithm.Voice"),", or else the default pitch algorithm (which in ",(0,l.kt)("inlineCode",{parentName:"p"},"SwiftAudioEx")," drops down to ",(0,l.kt)("inlineCode",{parentName:"p"},"AVAudioTimePitchAlgorithm.lowQualityZeroLatency"),") will likely\ndrop words in your audio."),(0,l.kt)("h2",{id:"getrate"},(0,l.kt)("inlineCode",{parentName:"h2"},"getRate()")),(0,l.kt)("p",null,"Gets the playback rate, where 1 is the regular speed."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"getprogress"},(0,l.kt)("inlineCode",{parentName:"h2"},"getProgress()")),(0,l.kt)("p",null,"Gets the playback ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/progress"},(0,l.kt)("inlineCode",{parentName:"a"},"Progress"))," of the active track."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/progress"},"Progress"),(0,l.kt)("inlineCode",{parentName:"p"},">")),(0,l.kt)("h2",{id:"getplaybackstate"},(0,l.kt)("inlineCode",{parentName:"h2"},"getPlaybackState()")),(0,l.kt)("p",null,"Gets the ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/playback-state"},(0,l.kt)("inlineCode",{parentName:"a"},"PlaybackState"))," of the player."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/playback-state"},"PlaybackState"),(0,l.kt)("inlineCode",{parentName:"p"},">")),(0,l.kt)("h2",{id:"getplaywhenready"},(0,l.kt)("inlineCode",{parentName:"h2"},"getPlayWhenReady()")),(0,l.kt)("p",null,"Gets the current state of ",(0,l.kt)("inlineCode",{parentName:"p"},"playWhenReady"),"."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"setplaywhenreadyplaywhenready"},(0,l.kt)("inlineCode",{parentName:"h2"},"setPlayWhenReady(playWhenReady)")),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.setPlayWhenReady(false)")," is the equivalent of ",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.pause()"),"\nand ",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.setPlayWhenReady(true)")," is the equivalent of\n",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.play()"),"."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"playWhenReady"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"boolean")),(0,l.kt)("td",{parentName:"tr",align:null},"A boolean representing if you want ",(0,l.kt)("inlineCode",{parentName:"td"},"playWhenReady")," set or not.")))),(0,l.kt)("h2",{id:"\ufe0f-getstate"},"\u26a0\ufe0f ",(0,l.kt)("inlineCode",{parentName:"h2"},"getState()")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated")),(0,l.kt)("p",null,"Gets the playback ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/state"},(0,l.kt)("inlineCode",{parentName:"a"},"State"))," of the player."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/state"},"State"),(0,l.kt)("inlineCode",{parentName:"p"},">")),(0,l.kt)("h2",{id:"\ufe0f-getduration"},"\u26a0\ufe0f ",(0,l.kt)("inlineCode",{parentName:"h2"},"getDuration()")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated")),(0,l.kt)("p",null,"Gets the duration of the current track in seconds."),(0,l.kt)("p",null,"Note: ",(0,l.kt)("inlineCode",{parentName:"p"},"react-native-track-player")," is a streaming library, which means it slowly buffers the track and doesn't know exactly when it ends.\nThe duration returned by this function is determined through various tricks and ",(0,l.kt)("em",{parentName:"p"},"may not be exact or may not be available at all"),"."),(0,l.kt)("p",null,"You should only trust the result of this function if you included the ",(0,l.kt)("inlineCode",{parentName:"p"},"duration")," property in the ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/track"},"Track Object"),"."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"\ufe0f-getposition"},"\u26a0\ufe0f ",(0,l.kt)("inlineCode",{parentName:"h2"},"getPosition()")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated")),(0,l.kt)("p",null,"Gets the position of the current track in seconds."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("h2",{id:"\ufe0f-getbufferedposition"},"\u26a0\ufe0f ",(0,l.kt)("inlineCode",{parentName:"h2"},"getBufferedPosition()")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated")),(0,l.kt)("p",null,"Gets the buffered position of the current track in seconds."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1977677a.5256d21b.js b/assets/js/1c0ad8e6.bd64bfb3.js similarity index 91% rename from assets/js/1977677a.5256d21b.js rename to assets/js/1c0ad8e6.bd64bfb3.js index 30316d79f..fe84f2270 100644 --- a/assets/js/1977677a.5256d21b.js +++ b/assets/js/1c0ad8e6.bd64bfb3.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[6804],{3905:function(e,t,r){r.d(t,{Zo:function(){return u},kt:function(){return b}});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),d=p(r),b=a,m=d["".concat(l,".").concat(b)]||d[b]||s[b]||o;return r?n.createElement(m,i(i({ref:t},u),{},{components:r})):n.createElement(m,i({ref:t},u))}));function b(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var p=2;p=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),d=p(r),b=a,m=d["".concat(l,".").concat(b)]||d[b]||s[b]||o;return r?n.createElement(m,i(i({ref:t},u),{},{components:r})):n.createElement(m,i({ref:t},u))}));function b(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var p=2;p=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var p=a.createContext({}),d=function(t){var e=a.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):l(l({},e),t)),n},u=function(t){var e=d(t.components);return a.createElement(p.Provider,{value:e},t.children)},s={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},c=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,i=t.originalType,p=t.parentName,u=o(t,["components","mdxType","originalType","parentName"]),c=d(n),m=r,k=c["".concat(p,".").concat(m)]||c[m]||s[m]||i;return n?a.createElement(k,l(l({ref:e},u),{},{components:n})):a.createElement(k,l({ref:e},u))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var i=n.length,l=new Array(i);l[0]=c;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:r,l[1]=o;for(var d=2;dsetupPlayer(options: PlayerOptions)",id:"setupplayeroptions-playeroptions",level:2},{value:"registerPlaybackService(serviceProvider)",id:"registerplaybackserviceserviceprovider",level:2},{value:"useTrackPlayerEvents(events: Event[], handler: Handler)",id:"usetrackplayereventsevents-event-handler-handler",level:2}],c={toc:s};function m(t){var e=t.components,n=(0,r.Z)(t,l);return(0,i.kt)("wrapper",(0,a.Z)({},c,n,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"lifecycle"},"Lifecycle"),(0,i.kt)("h2",{id:"setupplayeroptions-playeroptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"setupPlayer(options: PlayerOptions)")),(0,i.kt)("p",null,"Initializes the player with the specified options. These options do not apply to all platforms, see chart below."),(0,i.kt)("p",null,"These options are different than the ones set using ",(0,i.kt)("inlineCode",{parentName:"p"},"updateOptions()"),". Options other than those listed below will not be applied."),(0,i.kt)("p",null,"You should always call this function (even without any options set) before using the player to make sure everything is initialized. Do not call this more than once in the lifetime of your app."),(0,i.kt)("p",null,"Note that on Android this method must only be called while the app is in the foreground, otherwise it will throw an error with code ",(0,i.kt)("inlineCode",{parentName:"p"},"'android_cannot_setup_player_in_background'"),". In this case you can wait for the app to be in the foreground and try again."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"),(0,i.kt)("th",{parentName:"tr",align:null},"Default"),(0,i.kt)("th",{parentName:"tr",align:"center"},"Android"),(0,i.kt)("th",{parentName:"tr",align:"center"},"iOS"),(0,i.kt)("th",{parentName:"tr",align:"center"},"Web"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"PlayerOptions")),(0,i.kt)("td",{parentName:"tr",align:null},"The options"),(0,i.kt)("td",{parentName:"tr",align:null}),(0,i.kt)("td",{parentName:"tr",align:"center"}),(0,i.kt)("td",{parentName:"tr",align:"center"}),(0,i.kt)("td",{parentName:"tr",align:"center"})),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.minBuffer"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Minimum time in seconds that needs to be buffered"),(0,i.kt)("td",{parentName:"tr",align:null},"15 (android), automatic (ios)"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.maxBuffer"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Maximum time in seconds that needs to be buffered"),(0,i.kt)("td",{parentName:"tr",align:null},"50"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.playBuffer"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Minimum time in seconds that needs to be buffered to start playing"),(0,i.kt)("td",{parentName:"tr",align:null},"2.5"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.backBuffer"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Time in seconds that should be kept in the buffer behind the current playhead time."),(0,i.kt)("td",{parentName:"tr",align:null},"0"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.maxCacheSize"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Maximum cache size in kilobytes"),(0,i.kt)("td",{parentName:"tr",align:null},"0"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.androidAudioContentType"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"AndroidAudioContentType")),(0,i.kt)("td",{parentName:"tr",align:null},"The audio content type indicates to the android system how you intend to use audio in your app."),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"AndroidAudioContentType.Music")),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.iosCategory"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"IOSCategory")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("a",{parentName:"td",href:"https://developer.apple.com/documentation/avfoundation/avaudiosession/1616615-category"},"AVAudioSession.Category")," for iOS. Sets on ",(0,i.kt)("inlineCode",{parentName:"td"},"play()")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"IOSCategory.Playback")),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.iosCategoryOptions"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"IOSCategoryOptions[]")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("a",{parentName:"td",href:"https://developer.apple.com/documentation/avfoundation/avaudiosession/1616503-categoryoptions"},"AVAudioSession.CategoryOptions")," for iOS. Sets on ",(0,i.kt)("inlineCode",{parentName:"td"},"play()")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"[]")),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.iosCategoryMode"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"IOSCategoryMode")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("a",{parentName:"td",href:"https://developer.apple.com/documentation/avfoundation/avaudiosession/1616508-mode"},"AVAudioSession.Mode")," for iOS. Sets on ",(0,i.kt)("inlineCode",{parentName:"td"},"play()")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"default")),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.autoHandleInterruptions"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"boolean")),(0,i.kt)("td",{parentName:"tr",align:null},"Indicates whether the player should automatically handle audio interruptions."),(0,i.kt)("td",{parentName:"tr",align:null},"false"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.autoUpdateMetadata"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"boolean")),(0,i.kt)("td",{parentName:"tr",align:null},"Indicates whether the player should automatically update now playing metadata data in control center / notification."),(0,i.kt)("td",{parentName:"tr",align:null},"true"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")))),(0,i.kt)("h2",{id:"registerplaybackserviceserviceprovider"},(0,i.kt)("inlineCode",{parentName:"h2"},"registerPlaybackService(serviceProvider)")),(0,i.kt)("p",null,"Register the playback service. The service will run as long as the player runs."),(0,i.kt)("p",null,"This function should only be called once, and should be registered right after registering your React application with ",(0,i.kt)("inlineCode",{parentName:"p"},"AppRegistry"),"."),(0,i.kt)("p",null,"You should use the playback service to register the event handlers that must be directly tied to the player, as the playback service might keep running when the app is in background."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"serviceProvider"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"function")),(0,i.kt)("td",{parentName:"tr",align:null},"The function that must return an async service function.")))),(0,i.kt)("h2",{id:"usetrackplayereventsevents-event-handler-handler"},(0,i.kt)("inlineCode",{parentName:"h2"},"useTrackPlayerEvents(events: Event[], handler: Handler)")),(0,i.kt)("p",null,"Hook that fires on the specified events."),(0,i.kt)("p",null,"You can find a list of events in the ",(0,i.kt)("a",{parentName:"p",href:"/docs/api/events#player"},"events section"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1cad3c18.6a77f160.js b/assets/js/1cad3c18.6a77f160.js deleted file mode 100644 index e01a0289d..000000000 --- a/assets/js/1cad3c18.6a77f160.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[6345],{3905:function(e,t,a){a.d(t,{Zo:function(){return d},kt:function(){return m}});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},d=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=s(a),m=r,k=c["".concat(p,".").concat(m)]||c[m]||u[m]||i;return a?n.createElement(k,o(o({ref:t},d),{},{components:a})):n.createElement(k,o({ref:t},d))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=c;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var s=2;s=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},d=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=s(a),m=r,k=c["".concat(p,".").concat(m)]||c[m]||u[m]||i;return a?n.createElement(k,o(o({ref:t},d),{},{components:a})):n.createElement(k,o({ref:t},d))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=c;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var s=2;s=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var p=a.createContext({}),d=function(t){var e=a.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):i(i({},e),t)),n},u=function(t){var e=d(t.components);return a.createElement(p.Provider,{value:e},t.children)},s={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},m=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,o=t.originalType,p=t.parentName,u=l(t,["components","mdxType","originalType","parentName"]),m=d(n),c=r,k=m["".concat(p,".").concat(c)]||m[c]||s[c]||o;return n?a.createElement(k,i(i({ref:e},u),{},{components:n})):a.createElement(k,i({ref:e},u))}));function c(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var o=n.length,i=new Array(o);i[0]=m;var l={};for(var p in e)hasOwnProperty.call(e,p)&&(l[p]=e[p]);l.originalType=t,l.mdxType="string"==typeof t?t:r,i[1]=l;for(var d=2;d=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var d=o.createContext({}),l=function(e){var t=o.useContext(d),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=l(e.components);return o.createElement(d.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var r=e.components,n=e.mdxType,i=e.originalType,d=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),u=l(r),f=n,m=u["".concat(d,".").concat(f)]||u[f]||p[f]||i;return r?o.createElement(m,a(a({ref:t},s),{},{components:r})):o.createElement(m,a({ref:t},s))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=r.length,a=new Array(i);a[0]=u;var c={};for(var d in t)hasOwnProperty.call(t,d)&&(c[d]=t[d]);c.originalType=e,c.mdxType="string"==typeof e?e:n,a[1]=c;for(var l=2;llibrary not found for -lswiftCoreAudio for architecture x86_64",id:"ios-enable-swift-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64",level:2},{value:"Android: CIRCULAR REFERENCE:com.android.tools.r8.ApiLevelException: Default interface methods are only supported starting with Android N (--min-api 24)",id:"android-circular-referencecomandroidtoolsr8apilevelexception-default-interface-methods-are-only-supported-starting-with-android-n---min-api-24",level:2},{value:"Android: com.facebook.react.common.JavascriptException: No task registered for key TrackPlayer",id:"android-comfacebookreactcommonjavascriptexception-no-task-registered-for-key-trackplayer",level:2},{value:"Android: Error: Attribute XXX from [androidx.core:core:XXX] is also present at [com.android.support:support-compat:XXX]",id:"android-error-attribute-xxx-from-androidxcorecorexxx-is-also-present-at-comandroidsupportsupport-compatxxx",level:2},{value:"Android: Cleartext HTTP traffic not permitted",id:"android-cleartext-http-traffic-not-permitted",level:2}],u={toc:p};function f(e){var t=e.components,r=(0,n.Z)(e,a);return(0,i.kt)("wrapper",(0,o.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"troubleshooting"},"Troubleshooting"),(0,i.kt)("h2",{id:"ios-enable-swift-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64"},"iOS: (Enable Swift) ",(0,i.kt)("inlineCode",{parentName:"h2"},"library not found for -lswiftCoreAudio for architecture x86_64")),(0,i.kt)("p",null,"Because the iOS module uses Swift, if the user is using a standard react-native application they'll need to add support for Swift in the project. This can easily be done by adding a swift file to the Xcode project -- could be called ",(0,i.kt)("inlineCode",{parentName:"p"},"dummy.swift")," and saying yes when prompted if you'd like to generate a bridging header."),(0,i.kt)("p",null,(0,i.kt)("img",{parentName:"p",src:"https://i.imgur.com/CBqBcWs.png",alt:"Importing Swift"})),(0,i.kt)("h2",{id:"android-circular-referencecomandroidtoolsr8apilevelexception-default-interface-methods-are-only-supported-starting-with-android-n---min-api-24"},"Android: ",(0,i.kt)("inlineCode",{parentName:"h2"},"CIRCULAR REFERENCE:com.android.tools.r8.ApiLevelException: Default interface methods are only supported starting with Android N (--min-api 24)")),(0,i.kt)("p",null,"Since version 1.0.0, we began using a few Java 8 features in the project to reduce the code size."),(0,i.kt)("p",null,"To fix the issue, add the following options to your ",(0,i.kt)("inlineCode",{parentName:"p"},"android/app/build.gradle")," file:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-diff"},"android {\n ...\n+ compileOptions {\n+ sourceCompatibility JavaVersion.VERSION_1_8\n+ targetCompatibility JavaVersion.VERSION_1_8\n+ }\n ...\n}\n")),(0,i.kt)("h2",{id:"android-comfacebookreactcommonjavascriptexception-no-task-registered-for-key-trackplayer"},"Android: ",(0,i.kt)("inlineCode",{parentName:"h2"},"com.facebook.react.common.JavascriptException: No task registered for key TrackPlayer")),(0,i.kt)("p",null,"The playback service requires a headless task to be registered. You have to register it with ",(0,i.kt)("inlineCode",{parentName:"p"},"registerPlaybackService"),"."),(0,i.kt)("h2",{id:"android-error-attribute-xxx-from-androidxcorecorexxx-is-also-present-at-comandroidsupportsupport-compatxxx"},"Android: ",(0,i.kt)("inlineCode",{parentName:"h2"},"Error: Attribute XXX from [androidx.core:core:XXX] is also present at [com.android.support:support-compat:XXX]")),(0,i.kt)("p",null,"This error occurs when you're mixing both AndroidX and the Support Library in the same project."),(0,i.kt)("p",null,"You have to either upgrade everything to AndroidX or downgrade everything to the support library."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"For react-native-track-player, the last version to run the support library is ",(0,i.kt)("strong",{parentName:"li"},"1.1.4")," and the first version to run AndroidX is ",(0,i.kt)("strong",{parentName:"li"},"1.2.0"),"."),(0,i.kt)("li",{parentName:"ul"},"For react-native, the last version to run the support library is ",(0,i.kt)("strong",{parentName:"li"},"0.59")," and the first version to run AndroidX is ",(0,i.kt)("strong",{parentName:"li"},"0.60"),".")),(0,i.kt)("p",null,"You can also use ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/mikehardy/jetifier#usage-for-source-files"},"jetifier")," to convert all of the native code to use only one of them."),(0,i.kt)("h2",{id:"android-cleartext-http-traffic-not-permitted"},"Android: Cleartext HTTP traffic not permitted"),(0,i.kt)("p",null,"Since API 28, Android disables traffic without TLS. To fix the issue you have to use ",(0,i.kt)("inlineCode",{parentName:"p"},"https")," or ",(0,i.kt)("a",{parentName:"p",href:"https://stackoverflow.com/a/50834600"},"enable clear text traffic"),"."))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/242d99d9.e8285c44.js b/assets/js/242d99d9.e8285c44.js new file mode 100644 index 000000000..67fe79a9f --- /dev/null +++ b/assets/js/242d99d9.e8285c44.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[8773],{3905:function(e,t,r){r.d(t,{Zo:function(){return s},kt:function(){return f}});var o=r(7294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function a(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var d=o.createContext({}),l=function(e){var t=o.useContext(d),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=l(e.components);return o.createElement(d.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var r=e.components,n=e.mdxType,i=e.originalType,d=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),u=l(r),f=n,m=u["".concat(d,".").concat(f)]||u[f]||p[f]||i;return r?o.createElement(m,a(a({ref:t},s),{},{components:r})):o.createElement(m,a({ref:t},s))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=r.length,a=new Array(i);a[0]=u;var c={};for(var d in t)hasOwnProperty.call(t,d)&&(c[d]=t[d]);c.originalType=e,c.mdxType="string"==typeof e?e:n,a[1]=c;for(var l=2;llibrary not found for -lswiftCoreAudio for architecture x86_64",id:"ios-enable-swift-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64",level:2},{value:"Android: CIRCULAR REFERENCE:com.android.tools.r8.ApiLevelException: Default interface methods are only supported starting with Android N (--min-api 24)",id:"android-circular-referencecomandroidtoolsr8apilevelexception-default-interface-methods-are-only-supported-starting-with-android-n---min-api-24",level:2},{value:"Android: com.facebook.react.common.JavascriptException: No task registered for key TrackPlayer",id:"android-comfacebookreactcommonjavascriptexception-no-task-registered-for-key-trackplayer",level:2},{value:"Android: Error: Attribute XXX from [androidx.core:core:XXX] is also present at [com.android.support:support-compat:XXX]",id:"android-error-attribute-xxx-from-androidxcorecorexxx-is-also-present-at-comandroidsupportsupport-compatxxx",level:2},{value:"Android: Cleartext HTTP traffic not permitted",id:"android-cleartext-http-traffic-not-permitted",level:2}],u={toc:p};function f(e){var t=e.components,r=(0,n.Z)(e,a);return(0,i.kt)("wrapper",(0,o.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"troubleshooting"},"Troubleshooting"),(0,i.kt)("h2",{id:"ios-enable-swift-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64"},"iOS: (Enable Swift) ",(0,i.kt)("inlineCode",{parentName:"h2"},"library not found for -lswiftCoreAudio for architecture x86_64")),(0,i.kt)("p",null,"Because the iOS module uses Swift, if the user is using a standard react-native application they'll need to add support for Swift in the project. This can easily be done by adding a swift file to the Xcode project -- could be called ",(0,i.kt)("inlineCode",{parentName:"p"},"dummy.swift")," and saying yes when prompted if you'd like to generate a bridging header."),(0,i.kt)("p",null,(0,i.kt)("img",{parentName:"p",src:"https://i.imgur.com/CBqBcWs.png",alt:"Importing Swift"})),(0,i.kt)("h2",{id:"android-circular-referencecomandroidtoolsr8apilevelexception-default-interface-methods-are-only-supported-starting-with-android-n---min-api-24"},"Android: ",(0,i.kt)("inlineCode",{parentName:"h2"},"CIRCULAR REFERENCE:com.android.tools.r8.ApiLevelException: Default interface methods are only supported starting with Android N (--min-api 24)")),(0,i.kt)("p",null,"Since version 1.0.0, we began using a few Java 8 features in the project to reduce the code size."),(0,i.kt)("p",null,"To fix the issue, add the following options to your ",(0,i.kt)("inlineCode",{parentName:"p"},"android/app/build.gradle")," file:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-diff"},"android {\n ...\n+ compileOptions {\n+ sourceCompatibility JavaVersion.VERSION_1_8\n+ targetCompatibility JavaVersion.VERSION_1_8\n+ }\n ...\n}\n")),(0,i.kt)("h2",{id:"android-comfacebookreactcommonjavascriptexception-no-task-registered-for-key-trackplayer"},"Android: ",(0,i.kt)("inlineCode",{parentName:"h2"},"com.facebook.react.common.JavascriptException: No task registered for key TrackPlayer")),(0,i.kt)("p",null,"The playback service requires a headless task to be registered. You have to register it with ",(0,i.kt)("inlineCode",{parentName:"p"},"registerPlaybackService"),"."),(0,i.kt)("h2",{id:"android-error-attribute-xxx-from-androidxcorecorexxx-is-also-present-at-comandroidsupportsupport-compatxxx"},"Android: ",(0,i.kt)("inlineCode",{parentName:"h2"},"Error: Attribute XXX from [androidx.core:core:XXX] is also present at [com.android.support:support-compat:XXX]")),(0,i.kt)("p",null,"This error occurs when you're mixing both AndroidX and the Support Library in the same project."),(0,i.kt)("p",null,"You have to either upgrade everything to AndroidX or downgrade everything to the support library."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"For react-native-track-player, the last version to run the support library is ",(0,i.kt)("strong",{parentName:"li"},"1.1.4")," and the first version to run AndroidX is ",(0,i.kt)("strong",{parentName:"li"},"1.2.0"),"."),(0,i.kt)("li",{parentName:"ul"},"For react-native, the last version to run the support library is ",(0,i.kt)("strong",{parentName:"li"},"0.59")," and the first version to run AndroidX is ",(0,i.kt)("strong",{parentName:"li"},"0.60"),".")),(0,i.kt)("p",null,"You can also use ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/mikehardy/jetifier#usage-for-source-files"},"jetifier")," to convert all of the native code to use only one of them."),(0,i.kt)("h2",{id:"android-cleartext-http-traffic-not-permitted"},"Android: Cleartext HTTP traffic not permitted"),(0,i.kt)("p",null,"Since API 28, Android disables traffic without TLS. To fix the issue you have to use ",(0,i.kt)("inlineCode",{parentName:"p"},"https")," or ",(0,i.kt)("a",{parentName:"p",href:"https://stackoverflow.com/a/50834600"},"enable clear text traffic"),"."))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f0536058.78bb1c4a.js b/assets/js/28d51b82.21535f6e.js similarity index 92% rename from assets/js/f0536058.78bb1c4a.js rename to assets/js/28d51b82.21535f6e.js index 5530a842f..6b385f1aa 100644 --- a/assets/js/f0536058.78bb1c4a.js +++ b/assets/js/28d51b82.21535f6e.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[5015],{3905:function(e,t,n){n.d(t,{Zo:function(){return s},kt:function(){return y}});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=p(n),y=r,f=d["".concat(l,".").concat(y)]||d[y]||u[y]||o;return n?a.createElement(f,i(i({ref:t},s),{},{components:n})):a.createElement(f,i({ref:t},s))}));function y(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var p=2;pContinuePlayback (default)",id:"continueplayback-default",level:2},{value:"PausePlayback",id:"pauseplayback",level:2},{value:"StopPlaybackAndRemoveNotification",id:"stopplaybackandremovenotification",level:2}],d={toc:u};function y(e){var t=e.components,n=(0,r.Z)(e,i);return(0,o.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"app-killed-playback-behavior-android-only"},"App Killed Playback Behavior (android-only)"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"import { AppKilledPlaybackBehavior } from 'react-native-track-player';\n")),(0,o.kt)("h2",{id:"continueplayback-default"},(0,o.kt)("inlineCode",{parentName:"h2"},"ContinuePlayback")," (default)"),(0,o.kt)("p",null,"This option will continue playing audio in the background when the app is\nremoved from recents. The notification remains. This is the default."),(0,o.kt)("h2",{id:"pauseplayback"},(0,o.kt)("inlineCode",{parentName:"h2"},"PausePlayback")),(0,o.kt)("p",null,"This option will pause playing audio in the background when the app is removed\nfrom recents. The notification remains and can be used to resume playback."),(0,o.kt)("h2",{id:"stopplaybackandremovenotification"},(0,o.kt)("inlineCode",{parentName:"h2"},"StopPlaybackAndRemoveNotification")),(0,o.kt)("p",null,"This option will stop playing audio in the background when the app is removed\nfrom recents. The notification is removed and can't be used to resume playback.\nUsers would need to open the app again to start playing audio."))}y.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[5217],{3905:function(e,t,n){n.d(t,{Zo:function(){return s},kt:function(){return y}});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=p(n),y=r,f=d["".concat(l,".").concat(y)]||d[y]||u[y]||o;return n?a.createElement(f,i(i({ref:t},s),{},{components:n})):a.createElement(f,i({ref:t},s))}));function y(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var p=2;pContinuePlayback (default)",id:"continueplayback-default",level:2},{value:"PausePlayback",id:"pauseplayback",level:2},{value:"StopPlaybackAndRemoveNotification",id:"stopplaybackandremovenotification",level:2}],d={toc:u};function y(e){var t=e.components,n=(0,r.Z)(e,i);return(0,o.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"app-killed-playback-behavior-android-only"},"App Killed Playback Behavior (android-only)"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"import { AppKilledPlaybackBehavior } from 'react-native-track-player';\n")),(0,o.kt)("h2",{id:"continueplayback-default"},(0,o.kt)("inlineCode",{parentName:"h2"},"ContinuePlayback")," (default)"),(0,o.kt)("p",null,"This option will continue playing audio in the background when the app is\nremoved from recents. The notification remains. This is the default."),(0,o.kt)("h2",{id:"pauseplayback"},(0,o.kt)("inlineCode",{parentName:"h2"},"PausePlayback")),(0,o.kt)("p",null,"This option will pause playing audio in the background when the app is removed\nfrom recents. The notification remains and can be used to resume playback."),(0,o.kt)("h2",{id:"stopplaybackandremovenotification"},(0,o.kt)("inlineCode",{parentName:"h2"},"StopPlaybackAndRemoveNotification")),(0,o.kt)("p",null,"This option will stop playing audio in the background when the app is removed\nfrom recents. The notification is removed and can't be used to resume playback.\nUsers would need to open the app again to start playing audio."))}y.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2dcdf14f.bd9d6b8b.js b/assets/js/2dcdf14f.bd9d6b8b.js new file mode 100644 index 000000000..19c9d75c3 --- /dev/null +++ b/assets/js/2dcdf14f.bd9d6b8b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1572],{3905:function(t,e,a){a.d(e,{Zo:function(){return m},kt:function(){return c}});var n=a(7294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function i(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var o=n.createContext({}),p=function(t){var e=n.useContext(o),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},m=function(t){var e=p(t.components);return n.createElement(o.Provider,{value:e},t.children)},u={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},k=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,o=t.parentName,m=d(t,["components","mdxType","originalType","parentName"]),k=p(a),c=r,g=k["".concat(o,".").concat(c)]||k[c]||u[c]||l;return a?n.createElement(g,i(i({ref:e},m),{},{components:a})):n.createElement(g,i({ref:e},m))}));function c(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=k;var d={};for(var o in e)hasOwnProperty.call(e,o)&&(d[o]=e[o]);d.originalType=t,d.mdxType="string"==typeof t?t:r,i[1]=d;for(var p=2;p=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var o=n.createContext({}),p=function(t){var e=n.useContext(o),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},m=function(t){var e=p(t.components);return n.createElement(o.Provider,{value:e},t.children)},u={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},k=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,o=t.parentName,m=d(t,["components","mdxType","originalType","parentName"]),k=p(a),c=r,g=k["".concat(o,".").concat(c)]||k[c]||u[c]||l;return a?n.createElement(g,i(i({ref:e},m),{},{components:a})):n.createElement(g,i({ref:e},m))}));function c(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=k;var d={};for(var o in e)hasOwnProperty.call(e,o)&&(d[o]=e[o]);d.originalType=t,d.mdxType="string"==typeof t?t:r,i[1]=d;for(var p=2;p=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),d=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},k=function(e){var t=d(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,k=o(e,["components","mdxType","originalType","parentName"]),m=d(a),c=r,s=m["".concat(p,".").concat(c)]||m[c]||u[c]||i;return a?n.createElement(s,l(l({ref:t},k),{},{components:a})):n.createElement(s,l({ref:t},k))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=m;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,l[1]=o;for(var d=2;dadd(tracks, insertBeforeIndex)",id:"addtracks-insertbeforeindex",level:2},{value:"remove(tracks)",id:"removetracks",level:2},{value:"setQueue(tracks)",id:"setqueuetracks",level:2},{value:"load(track)",id:"loadtrack",level:2},{value:"skip(index, initialPosition)",id:"skipindex-initialposition",level:2},{value:"skipToNext(initialPosition)",id:"skiptonextinitialposition",level:2},{value:"skipToPrevious(initialPosition)",id:"skiptopreviousinitialposition",level:2},{value:"move(fromIndex, toIndex)",id:"movefromindex-toindex",level:2},{value:"reset()",id:"reset",level:2},{value:"getTrack(index)",id:"gettrackindex",level:2},{value:"getActiveTrack()",id:"getactivetrack",level:2},{value:"getActiveTrackIndex()",id:"getactivetrackindex",level:2},{value:"getQueue()",id:"getqueue",level:2},{value:"removeUpcomingTracks()",id:"removeupcomingtracks",level:2},{value:"updateMetadataForTrack(index, metadata)",id:"updatemetadatafortrackindex-metadata",level:2},{value:"setRepeatMode(mode)",id:"setrepeatmodemode",level:2},{value:"getRepeatMode()",id:"getrepeatmode",level:2},{value:"\u26a0\ufe0f getCurrentTrack()",id:"\ufe0f-getcurrenttrack",level:2}],m={toc:u};function c(e){var t=e.components,a=(0,r.Z)(e,l);return(0,i.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"queue"},"Queue"),(0,i.kt)("h2",{id:"addtracks-insertbeforeindex"},(0,i.kt)("inlineCode",{parentName:"h2"},"add(tracks, insertBeforeIndex)")),(0,i.kt)("p",null,"Adds one or more tracks to the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")," - The promise resolves with the first\nadded track index. If no tracks were added it returns ",(0,i.kt)("inlineCode",{parentName:"p"},"void"),"."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"tracks"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"Track \\| Track[]")),(0,i.kt)("td",{parentName:"tr",align:null},"The ",(0,i.kt)("a",{parentName:"td",href:"/docs/api/objects/track"},"Track")," objects that will be added")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"insertBeforeIndex"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The index of the track that will be located immediately after the inserted tracks. Set it to ",(0,i.kt)("inlineCode",{parentName:"td"},"null")," to add it at the end of the queue")))),(0,i.kt)("h2",{id:"removetracks"},(0,i.kt)("inlineCode",{parentName:"h2"},"remove(tracks)")),(0,i.kt)("p",null,"Removes one or more tracks from the queue. If the current track is removed, the next track will activated. If the current track was the last track in the queue, the first track will be activated."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"tracks"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"Track \\| Track[]")),(0,i.kt)("td",{parentName:"tr",align:null},"The ",(0,i.kt)("a",{parentName:"td",href:"/docs/api/objects/track"},"Track")," objects that will be removed")))),(0,i.kt)("h2",{id:"setqueuetracks"},(0,i.kt)("inlineCode",{parentName:"h2"},"setQueue(tracks)")),(0,i.kt)("p",null,"Clears the current queue and adds the supplied tracks to the now empty queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"tracks"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"Track[]")),(0,i.kt)("td",{parentName:"tr",align:null},"An array of ",(0,i.kt)("a",{parentName:"td",href:"/docs/api/objects/track"},"Track")," to replace the current queue with.")))),(0,i.kt)("h2",{id:"loadtrack"},(0,i.kt)("inlineCode",{parentName:"h2"},"load(track)")),(0,i.kt)("p",null,"Replaces the current track with the supplied track or creates a track when the queue is empty."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"track"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"Track")),(0,i.kt)("td",{parentName:"tr",align:null},"The ",(0,i.kt)("a",{parentName:"td",href:"/docs/api/objects/track"},"Track")," object that will be loaded")))),(0,i.kt)("h2",{id:"skipindex-initialposition"},(0,i.kt)("inlineCode",{parentName:"h2"},"skip(index, initialPosition)")),(0,i.kt)("p",null,"Skips to a track in the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"index"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The track index")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"initialPosition"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("strong",{parentName:"td"},"Optional.")," Sets the initial playback for the track you're skipping to.")))),(0,i.kt)("h2",{id:"skiptonextinitialposition"},(0,i.kt)("inlineCode",{parentName:"h2"},"skipToNext(initialPosition)")),(0,i.kt)("p",null,"Skips to the next track in the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"initialPosition"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("strong",{parentName:"td"},"Optional.")," Sets the initial playback for the track you're skipping to.")))),(0,i.kt)("h2",{id:"skiptopreviousinitialposition"},(0,i.kt)("inlineCode",{parentName:"h2"},"skipToPrevious(initialPosition)")),(0,i.kt)("p",null,"Skips to the previous track in the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"initialPosition"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("strong",{parentName:"td"},"Optional.")," Sets the initial playback for the track you're skipping to.")))),(0,i.kt)("h2",{id:"movefromindex-toindex"},(0,i.kt)("inlineCode",{parentName:"h2"},"move(fromIndex, toIndex)")),(0,i.kt)("p",null,"Moves a track from the specified index to another."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"fromIndex"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The index of the track you'd like to move.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"toIndex"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The position you'd like to move the track to.")))),(0,i.kt)("h2",{id:"reset"},(0,i.kt)("inlineCode",{parentName:"h2"},"reset()")),(0,i.kt)("p",null,"Resets the player stopping the current track and clearing the queue."),(0,i.kt)("h2",{id:"gettrackindex"},(0,i.kt)("inlineCode",{parentName:"h2"},"getTrack(index)")),(0,i.kt)("p",null,"Gets a track object from the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,i.kt)("a",{parentName:"p",href:"/docs/api/objects/track"},"Track"),(0,i.kt)("inlineCode",{parentName:"p"},">")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"index"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The track index")))),(0,i.kt)("h2",{id:"getactivetrack"},(0,i.kt)("inlineCode",{parentName:"h2"},"getActiveTrack()")),(0,i.kt)("p",null,"Gets the active track object."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,i.kt)("a",{parentName:"p",href:"/docs/api/objects/track"},"Track"),(0,i.kt)("inlineCode",{parentName:"p"}," | undefined>")),(0,i.kt)("h2",{id:"getactivetrackindex"},(0,i.kt)("inlineCode",{parentName:"h2"},"getActiveTrackIndex()")),(0,i.kt)("p",null,"Gets the index of the current track, or ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined")," if no track loaded"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("h2",{id:"getqueue"},(0,i.kt)("inlineCode",{parentName:"h2"},"getQueue()")),(0,i.kt)("p",null,"Gets the whole queue"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,i.kt)("a",{parentName:"p",href:"/docs/api/objects/track"},"Track[]"),(0,i.kt)("inlineCode",{parentName:"p"},">")),(0,i.kt)("h2",{id:"removeupcomingtracks"},(0,i.kt)("inlineCode",{parentName:"h2"},"removeUpcomingTracks()")),(0,i.kt)("p",null,"Clears any upcoming tracks from the queue."),(0,i.kt)("h2",{id:"updatemetadatafortrackindex-metadata"},(0,i.kt)("inlineCode",{parentName:"h2"},"updateMetadataForTrack(index, metadata)")),(0,i.kt)("p",null,"Updates the metadata of a track in the queue.\nIf the current track is updated, the notification and the Now Playing Center will be updated accordingly."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"index"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The track index")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"metadata"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"object")),(0,i.kt)("td",{parentName:"tr",align:null},"A subset of the ",(0,i.kt)("a",{parentName:"td",href:"/docs/api/objects/track"},"Track Object")," with only the ",(0,i.kt)("inlineCode",{parentName:"td"},"artwork"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"title"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"artist"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"album"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"description"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"genre"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"date"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"rating")," and ",(0,i.kt)("inlineCode",{parentName:"td"},"duration")," properties.")))),(0,i.kt)("h2",{id:"setrepeatmodemode"},(0,i.kt)("inlineCode",{parentName:"h2"},"setRepeatMode(mode)")),(0,i.kt)("p",null,"Sets the repeat mode."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"mode"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("a",{parentName:"td",href:"/docs/api/constants/repeat-mode"},"Repeat Mode")),(0,i.kt)("td",{parentName:"tr",align:null},"The repeat mode")))),(0,i.kt)("h2",{id:"getrepeatmode"},(0,i.kt)("inlineCode",{parentName:"h2"},"getRepeatMode()")),(0,i.kt)("p",null,"Gets the repeat mode."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("a",{parentName:"p",href:"/docs/api/constants/repeat-mode"},"Repeat Mode")),(0,i.kt)("h2",{id:"\ufe0f-getcurrenttrack"},"\u26a0\ufe0f ",(0,i.kt)("inlineCode",{parentName:"h2"},"getCurrentTrack()")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated:")," To get the active track index use\n",(0,i.kt)("a",{parentName:"p",href:"#getactivetrackindex"},(0,i.kt)("inlineCode",{parentName:"a"},"getActiveTrackIndex()"))," instead or use\n",(0,i.kt)("a",{parentName:"p",href:"#getactivetrack"},(0,i.kt)("inlineCode",{parentName:"a"},"getActiveTrack()"))," to get the active track object."),(0,i.kt)("p",null,"Gets the index of the current track, or null if no track loaded"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[3952],{3905:function(e,t,a){a.d(t,{Zo:function(){return k},kt:function(){return c}});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),d=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},k=function(e){var t=d(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,k=o(e,["components","mdxType","originalType","parentName"]),m=d(a),c=r,s=m["".concat(p,".").concat(c)]||m[c]||u[c]||i;return a?n.createElement(s,l(l({ref:t},k),{},{components:a})):n.createElement(s,l({ref:t},k))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=m;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,l[1]=o;for(var d=2;dadd(tracks, insertBeforeIndex)",id:"addtracks-insertbeforeindex",level:2},{value:"remove(tracks)",id:"removetracks",level:2},{value:"setQueue(tracks)",id:"setqueuetracks",level:2},{value:"load(track)",id:"loadtrack",level:2},{value:"skip(index, initialPosition)",id:"skipindex-initialposition",level:2},{value:"skipToNext(initialPosition)",id:"skiptonextinitialposition",level:2},{value:"skipToPrevious(initialPosition)",id:"skiptopreviousinitialposition",level:2},{value:"move(fromIndex, toIndex)",id:"movefromindex-toindex",level:2},{value:"reset()",id:"reset",level:2},{value:"getTrack(index)",id:"gettrackindex",level:2},{value:"getActiveTrack()",id:"getactivetrack",level:2},{value:"getActiveTrackIndex()",id:"getactivetrackindex",level:2},{value:"getQueue()",id:"getqueue",level:2},{value:"removeUpcomingTracks()",id:"removeupcomingtracks",level:2},{value:"updateMetadataForTrack(index, metadata)",id:"updatemetadatafortrackindex-metadata",level:2},{value:"setRepeatMode(mode)",id:"setrepeatmodemode",level:2},{value:"getRepeatMode()",id:"getrepeatmode",level:2},{value:"\u26a0\ufe0f getCurrentTrack()",id:"\ufe0f-getcurrenttrack",level:2}],m={toc:u};function c(e){var t=e.components,a=(0,r.Z)(e,l);return(0,i.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"queue"},"Queue"),(0,i.kt)("h2",{id:"addtracks-insertbeforeindex"},(0,i.kt)("inlineCode",{parentName:"h2"},"add(tracks, insertBeforeIndex)")),(0,i.kt)("p",null,"Adds one or more tracks to the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")," - The promise resolves with the first\nadded track index. If no tracks were added it returns ",(0,i.kt)("inlineCode",{parentName:"p"},"void"),"."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"tracks"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"Track \\| Track[]")),(0,i.kt)("td",{parentName:"tr",align:null},"The ",(0,i.kt)("a",{parentName:"td",href:"/docs/api/objects/track"},"Track")," objects that will be added")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"insertBeforeIndex"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The index of the track that will be located immediately after the inserted tracks. Set it to ",(0,i.kt)("inlineCode",{parentName:"td"},"null")," to add it at the end of the queue")))),(0,i.kt)("h2",{id:"removetracks"},(0,i.kt)("inlineCode",{parentName:"h2"},"remove(tracks)")),(0,i.kt)("p",null,"Removes one or more tracks from the queue. If the current track is removed, the next track will activated. If the current track was the last track in the queue, the first track will be activated."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"tracks"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"Track \\| Track[]")),(0,i.kt)("td",{parentName:"tr",align:null},"The ",(0,i.kt)("a",{parentName:"td",href:"/docs/api/objects/track"},"Track")," objects that will be removed")))),(0,i.kt)("h2",{id:"setqueuetracks"},(0,i.kt)("inlineCode",{parentName:"h2"},"setQueue(tracks)")),(0,i.kt)("p",null,"Clears the current queue and adds the supplied tracks to the now empty queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"tracks"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"Track[]")),(0,i.kt)("td",{parentName:"tr",align:null},"An array of ",(0,i.kt)("a",{parentName:"td",href:"/docs/api/objects/track"},"Track")," to replace the current queue with.")))),(0,i.kt)("h2",{id:"loadtrack"},(0,i.kt)("inlineCode",{parentName:"h2"},"load(track)")),(0,i.kt)("p",null,"Replaces the current track with the supplied track or creates a track when the queue is empty."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"track"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"Track")),(0,i.kt)("td",{parentName:"tr",align:null},"The ",(0,i.kt)("a",{parentName:"td",href:"/docs/api/objects/track"},"Track")," object that will be loaded")))),(0,i.kt)("h2",{id:"skipindex-initialposition"},(0,i.kt)("inlineCode",{parentName:"h2"},"skip(index, initialPosition)")),(0,i.kt)("p",null,"Skips to a track in the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"index"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The track index")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"initialPosition"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("strong",{parentName:"td"},"Optional.")," Sets the initial playback for the track you're skipping to.")))),(0,i.kt)("h2",{id:"skiptonextinitialposition"},(0,i.kt)("inlineCode",{parentName:"h2"},"skipToNext(initialPosition)")),(0,i.kt)("p",null,"Skips to the next track in the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"initialPosition"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("strong",{parentName:"td"},"Optional.")," Sets the initial playback for the track you're skipping to.")))),(0,i.kt)("h2",{id:"skiptopreviousinitialposition"},(0,i.kt)("inlineCode",{parentName:"h2"},"skipToPrevious(initialPosition)")),(0,i.kt)("p",null,"Skips to the previous track in the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"initialPosition"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("strong",{parentName:"td"},"Optional.")," Sets the initial playback for the track you're skipping to.")))),(0,i.kt)("h2",{id:"movefromindex-toindex"},(0,i.kt)("inlineCode",{parentName:"h2"},"move(fromIndex, toIndex)")),(0,i.kt)("p",null,"Moves a track from the specified index to another."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"fromIndex"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The index of the track you'd like to move.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"toIndex"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The position you'd like to move the track to.")))),(0,i.kt)("h2",{id:"reset"},(0,i.kt)("inlineCode",{parentName:"h2"},"reset()")),(0,i.kt)("p",null,"Resets the player stopping the current track and clearing the queue."),(0,i.kt)("h2",{id:"gettrackindex"},(0,i.kt)("inlineCode",{parentName:"h2"},"getTrack(index)")),(0,i.kt)("p",null,"Gets a track object from the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,i.kt)("a",{parentName:"p",href:"/docs/api/objects/track"},"Track"),(0,i.kt)("inlineCode",{parentName:"p"},">")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"index"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The track index")))),(0,i.kt)("h2",{id:"getactivetrack"},(0,i.kt)("inlineCode",{parentName:"h2"},"getActiveTrack()")),(0,i.kt)("p",null,"Gets the active track object."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,i.kt)("a",{parentName:"p",href:"/docs/api/objects/track"},"Track"),(0,i.kt)("inlineCode",{parentName:"p"}," | undefined>")),(0,i.kt)("h2",{id:"getactivetrackindex"},(0,i.kt)("inlineCode",{parentName:"h2"},"getActiveTrackIndex()")),(0,i.kt)("p",null,"Gets the index of the current track, or ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined")," if no track loaded"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("h2",{id:"getqueue"},(0,i.kt)("inlineCode",{parentName:"h2"},"getQueue()")),(0,i.kt)("p",null,"Gets the whole queue"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,i.kt)("a",{parentName:"p",href:"/docs/api/objects/track"},"Track[]"),(0,i.kt)("inlineCode",{parentName:"p"},">")),(0,i.kt)("h2",{id:"removeupcomingtracks"},(0,i.kt)("inlineCode",{parentName:"h2"},"removeUpcomingTracks()")),(0,i.kt)("p",null,"Clears any upcoming tracks from the queue."),(0,i.kt)("h2",{id:"updatemetadatafortrackindex-metadata"},(0,i.kt)("inlineCode",{parentName:"h2"},"updateMetadataForTrack(index, metadata)")),(0,i.kt)("p",null,"Updates the metadata of a track in the queue.\nIf the current track is updated, the notification and the Now Playing Center will be updated accordingly."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"index"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The track index")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"metadata"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"object")),(0,i.kt)("td",{parentName:"tr",align:null},"A subset of the ",(0,i.kt)("a",{parentName:"td",href:"/docs/api/objects/track"},"Track Object")," with only the ",(0,i.kt)("inlineCode",{parentName:"td"},"artwork"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"title"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"artist"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"album"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"description"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"genre"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"date"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"rating")," and ",(0,i.kt)("inlineCode",{parentName:"td"},"duration")," properties.")))),(0,i.kt)("h2",{id:"setrepeatmodemode"},(0,i.kt)("inlineCode",{parentName:"h2"},"setRepeatMode(mode)")),(0,i.kt)("p",null,"Sets the repeat mode."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"mode"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("a",{parentName:"td",href:"/docs/api/constants/repeat-mode"},"Repeat Mode")),(0,i.kt)("td",{parentName:"tr",align:null},"The repeat mode")))),(0,i.kt)("h2",{id:"getrepeatmode"},(0,i.kt)("inlineCode",{parentName:"h2"},"getRepeatMode()")),(0,i.kt)("p",null,"Gets the repeat mode."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("a",{parentName:"p",href:"/docs/api/constants/repeat-mode"},"Repeat Mode")),(0,i.kt)("h2",{id:"\ufe0f-getcurrenttrack"},"\u26a0\ufe0f ",(0,i.kt)("inlineCode",{parentName:"h2"},"getCurrentTrack()")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated:")," To get the active track index use\n",(0,i.kt)("a",{parentName:"p",href:"#getactivetrackindex"},(0,i.kt)("inlineCode",{parentName:"a"},"getActiveTrackIndex()"))," instead or use\n",(0,i.kt)("a",{parentName:"p",href:"#getactivetrack"},(0,i.kt)("inlineCode",{parentName:"a"},"getActiveTrack()"))," to get the active track object."),(0,i.kt)("p",null,"Gets the index of the current track, or null if no track loaded"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1291c0ae.7fee9b75.js b/assets/js/3b4d5c14.3d1b8c2a.js similarity index 95% rename from assets/js/1291c0ae.7fee9b75.js rename to assets/js/3b4d5c14.3d1b8c2a.js index 977ccb747..c2bb4d724 100644 --- a/assets/js/1291c0ae.7fee9b75.js +++ b/assets/js/3b4d5c14.3d1b8c2a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[9741],{3905:function(t,e,a){a.d(e,{Zo:function(){return c},kt:function(){return s}});var n=a(7294);function i(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function r(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function l(t){for(var e=1;e=0||(i[a]=t[a]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(i[a]=t[a])}return i}var p=n.createContext({}),d=function(t){var e=n.useContext(p),a=e;return t&&(a="function"==typeof t?t(e):l(l({},e),t)),a},c=function(t){var e=d(t.components);return n.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},u=n.forwardRef((function(t,e){var a=t.components,i=t.mdxType,r=t.originalType,p=t.parentName,c=o(t,["components","mdxType","originalType","parentName"]),u=d(a),s=i,y=u["".concat(p,".").concat(s)]||u[s]||m[s]||r;return a?n.createElement(y,l(l({ref:e},c),{},{components:a})):n.createElement(y,l({ref:e},c))}));function s(t,e){var a=arguments,i=e&&e.mdxType;if("string"==typeof t||i){var r=a.length,l=new Array(r);l[0]=u;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:i,l[1]=o;for(var d=2;d=0||(i[a]=t[a]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(i[a]=t[a])}return i}var p=n.createContext({}),d=function(t){var e=n.useContext(p),a=e;return t&&(a="function"==typeof t?t(e):l(l({},e),t)),a},c=function(t){var e=d(t.components);return n.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},u=n.forwardRef((function(t,e){var a=t.components,i=t.mdxType,r=t.originalType,p=t.parentName,c=o(t,["components","mdxType","originalType","parentName"]),u=d(a),s=i,y=u["".concat(p,".").concat(s)]||u[s]||m[s]||r;return a?n.createElement(y,l(l({ref:e},c),{},{components:a})):n.createElement(y,l({ref:e},c))}));function s(t,e){var a=arguments,i=e&&e.mdxType;if("string"==typeof t||i){var r=a.length,l=new Array(r);l[0]=u;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:i,l[1]=o;for(var d=2;d=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=t.createContext({}),d=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):i(i({},n),e)),r},s=function(e){var n=d(e.components);return t.createElement(p.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},c=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),c=d(r),m=o,f=c["".concat(p,".").concat(m)]||c[m]||u[m]||a;return r?t.createElement(f,i(i({ref:n},s),{},{components:r})):t.createElement(f,i({ref:n},s))}));function m(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=c;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var d=2;dapp/build.gradle",id:"edit-appbuildgradle",level:3},{value:"Build Using Variants",id:"build-using-variants",level:3}],c={toc:u};function m(e){var n=e.components,r=(0,o.Z)(e,i);return(0,a.kt)("wrapper",(0,t.Z)({},c,r,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"amazon-fireos-support"},"Amazon FireOS Support"),(0,a.kt)("p",null,"Support for Android in ",(0,a.kt)("inlineCode",{parentName:"p"},"react-native-track-player")," is built on top of the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/google/ExoPlayer"},"ExoPlayer")," media player library provided by Google. ExoPlayer does not officially support Amazon's FireOS fork of Android, because it does not pass ",(0,a.kt)("a",{parentName:"p",href:"https://source.android.com/compatibility/cts"},"Android CTS"),". ExoPlayer seems to work decently on FireOS 5, but it hardly works at all on FireOS 4."),(0,a.kt)("p",null,"Thankfully, ",(0,a.kt)("a",{parentName:"p",href:"https://developer.amazon.com/docs/fire-tv/media-players.html#exoplayer"},"Amazon maintains")," a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/amzn/exoplayer-amazon-port"},"ported version of ExoPlayer")," that can be used as a direct replacement as long as matching versions are used."),(0,a.kt)("h2",{id:"setup"},"Setup"),(0,a.kt)("p",null,"In order to fully support FireOS, you will need to build separate APKs for Google and Amazon. This can be accomplised using gradle flavors."),(0,a.kt)("p",null,"You will need to choose a ExoPlayer version that has been ported by Amazon, and that is close enough to the version that ",(0,a.kt)("inlineCode",{parentName:"p"},"react-native-track-player")," currently uses, in order to compile. In this example we have chosen to use ",(0,a.kt)("inlineCode",{parentName:"p"},"2.9.0"),"."),(0,a.kt)("h3",{id:"edit-appbuildgradle"},"Edit ",(0,a.kt)("inlineCode",{parentName:"h3"},"app/build.gradle")),(0,a.kt)("p",null,"Add ",(0,a.kt)("inlineCode",{parentName:"p"},"productFlavors")," to your build file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'android {\n flavorDimensions "store"\n productFlavors {\n google {\n dimension "store"\n }\n amazon {\n dimension "store"\n }\n }\n ...\n}\n')),(0,a.kt)("p",null,"Override the exoplayer library, and version, by modifying the dependencies:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"dependencies {\n compile (project(':react-native-track-player')) {\n exclude group: 'com.google.android.exoplayer'\n }\n googleImplementation 'com.google.android.exoplayer:exoplayer-core:2.10.1'\n amazonImplementation 'com.amazon.android:exoplayer-core:2.10.1'\n ...\n}\n")),(0,a.kt)("h3",{id:"build-using-variants"},"Build Using Variants"),(0,a.kt)("p",null,"To make builds using either Google or Amazon libraries, you will need to specify a build variant when you build."),(0,a.kt)("p",null,"Here are some examples of ",(0,a.kt)("inlineCode",{parentName:"p"},"react-native")," commands using the ",(0,a.kt)("inlineCode",{parentName:"p"},"--variant")," parameter that can be added as scripts in ",(0,a.kt)("inlineCode",{parentName:"p"},"package.json"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'"scripts": {\n "android-google": "react-native run-android --variant=googleDebug",\n "android-amazon": "react-native run-android --variant=amazonDebug",\n "android-release-google": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle && react-native run-android --variant=googleRelease",\n "android-release-amazon": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle && react-native run-android --variant=amazonRelease",\n ...\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[8113],{3905:function(e,n,r){r.d(n,{Zo:function(){return s},kt:function(){return m}});var t=r(7294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function i(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=t.createContext({}),d=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):i(i({},n),e)),r},s=function(e){var n=d(e.components);return t.createElement(p.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},c=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),c=d(r),m=o,f=c["".concat(p,".").concat(m)]||c[m]||u[m]||a;return r?t.createElement(f,i(i({ref:n},s),{},{components:r})):t.createElement(f,i({ref:n},s))}));function m(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=c;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var d=2;dapp/build.gradle",id:"edit-appbuildgradle",level:3},{value:"Build Using Variants",id:"build-using-variants",level:3}],c={toc:u};function m(e){var n=e.components,r=(0,o.Z)(e,i);return(0,a.kt)("wrapper",(0,t.Z)({},c,r,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"amazon-fireos-support"},"Amazon FireOS Support"),(0,a.kt)("p",null,"Support for Android in ",(0,a.kt)("inlineCode",{parentName:"p"},"react-native-track-player")," is built on top of the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/google/ExoPlayer"},"ExoPlayer")," media player library provided by Google. ExoPlayer does not officially support Amazon's FireOS fork of Android, because it does not pass ",(0,a.kt)("a",{parentName:"p",href:"https://source.android.com/compatibility/cts"},"Android CTS"),". ExoPlayer seems to work decently on FireOS 5, but it hardly works at all on FireOS 4."),(0,a.kt)("p",null,"Thankfully, ",(0,a.kt)("a",{parentName:"p",href:"https://developer.amazon.com/docs/fire-tv/media-players.html#exoplayer"},"Amazon maintains")," a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/amzn/exoplayer-amazon-port"},"ported version of ExoPlayer")," that can be used as a direct replacement as long as matching versions are used."),(0,a.kt)("h2",{id:"setup"},"Setup"),(0,a.kt)("p",null,"In order to fully support FireOS, you will need to build separate APKs for Google and Amazon. This can be accomplised using gradle flavors."),(0,a.kt)("p",null,"You will need to choose a ExoPlayer version that has been ported by Amazon, and that is close enough to the version that ",(0,a.kt)("inlineCode",{parentName:"p"},"react-native-track-player")," currently uses, in order to compile. In this example we have chosen to use ",(0,a.kt)("inlineCode",{parentName:"p"},"2.9.0"),"."),(0,a.kt)("h3",{id:"edit-appbuildgradle"},"Edit ",(0,a.kt)("inlineCode",{parentName:"h3"},"app/build.gradle")),(0,a.kt)("p",null,"Add ",(0,a.kt)("inlineCode",{parentName:"p"},"productFlavors")," to your build file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'android {\n flavorDimensions "store"\n productFlavors {\n google {\n dimension "store"\n }\n amazon {\n dimension "store"\n }\n }\n ...\n}\n')),(0,a.kt)("p",null,"Override the exoplayer library, and version, by modifying the dependencies:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"dependencies {\n compile (project(':react-native-track-player')) {\n exclude group: 'com.google.android.exoplayer'\n }\n googleImplementation 'com.google.android.exoplayer:exoplayer-core:2.10.1'\n amazonImplementation 'com.amazon.android:exoplayer-core:2.10.1'\n ...\n}\n")),(0,a.kt)("h3",{id:"build-using-variants"},"Build Using Variants"),(0,a.kt)("p",null,"To make builds using either Google or Amazon libraries, you will need to specify a build variant when you build."),(0,a.kt)("p",null,"Here are some examples of ",(0,a.kt)("inlineCode",{parentName:"p"},"react-native")," commands using the ",(0,a.kt)("inlineCode",{parentName:"p"},"--variant")," parameter that can be added as scripts in ",(0,a.kt)("inlineCode",{parentName:"p"},"package.json"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'"scripts": {\n "android-google": "react-native run-android --variant=googleDebug",\n "android-amazon": "react-native run-android --variant=amazonDebug",\n "android-release-google": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle && react-native run-android --variant=googleRelease",\n "android-release-amazon": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle && react-native run-android --variant=amazonRelease",\n ...\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/426721b3.f88060bf.js b/assets/js/426721b3.92cb4d9f.js similarity index 57% rename from assets/js/426721b3.f88060bf.js rename to assets/js/426721b3.92cb4d9f.js index 0a794bc65..cda3c0dfa 100644 --- a/assets/js/426721b3.f88060bf.js +++ b/assets/js/426721b3.92cb4d9f.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[8809],{3905:function(e,t,r){r.d(t,{Zo:function(){return s},kt:function(){return b}});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=p(r),b=a,y=d["".concat(l,".").concat(b)]||d[b]||u[b]||o;return r?n.createElement(y,i(i({ref:t},s),{},{components:r})):n.createElement(y,i({ref:t},s))}));function b(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var p=2;p=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=p(r),b=a,y=d["".concat(l,".").concat(b)]||d[b]||u[b]||o;return r?n.createElement(y,i(i({ref:t},s),{},{components:r})):n.createElement(y,i({ref:t},s))}));function b(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var p=2;p=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var p=n.createContext({}),l=function(e){var t=n.useContext(p),o=t;return e&&(o="function"==typeof e?e(t):i(i({},t),e)),o},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=l(o),h=r,m=d["".concat(p,".").concat(h)]||d[h]||c[h]||a;return o?n.createElement(m,i(i({ref:t},u),{},{components:o})):n.createElement(m,i({ref:t},u))}));function h(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=o.length,i=new Array(a);i[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;lMixWithOthers",id:"mixwithothers",level:2},{value:"DuckOthers",id:"duckothers",level:2},{value:"InterruptSpokenAudioAndMixWithOthers",id:"interruptspokenaudioandmixwithothers",level:2},{value:"AllowBluetooth",id:"allowbluetooth",level:2},{value:"AllowBluetoothA2DP",id:"allowbluetootha2dp",level:2},{value:"AllowAirPlay",id:"allowairplay",level:2},{value:"DefaultToSpeaker",id:"defaulttospeaker",level:2}],d={toc:c};function h(e){var t=e.components,o=(0,r.Z)(e,i);return(0,a.kt)("wrapper",(0,n.Z)({},d,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"ios-category-options-ios-only"},"iOS Category Options (ios-only)"),(0,a.kt)("p",null,"All iOS Category Options types are made available through the named export ",(0,a.kt)("inlineCode",{parentName:"p"},"IOSCategoryOptions"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"import { IOSCategoryOptions } from 'react-native-track-player';\n")),(0,a.kt)("h2",{id:"mixwithothers"},(0,a.kt)("inlineCode",{parentName:"h2"},"MixWithOthers")),(0,a.kt)("p",null,"An option that indicates whether audio from this session mixes with audio\nfrom active sessions in other audio apps."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616611-mixwithothers"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"duckothers"},(0,a.kt)("inlineCode",{parentName:"h2"},"DuckOthers")),(0,a.kt)("p",null,"An option that reduces the volume of other audio sessions while audio from\nthis session plays."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616618-duckothers"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"interruptspokenaudioandmixwithothers"},(0,a.kt)("inlineCode",{parentName:"h2"},"InterruptSpokenAudioAndMixWithOthers")),(0,a.kt)("p",null,"An option that determines whether to pause spoken audio content from other\nsessions when your app plays its audio."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616534-interruptspokenaudioandmixwithot"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"allowbluetooth"},(0,a.kt)("inlineCode",{parentName:"h2"},"AllowBluetooth")),(0,a.kt)("p",null,"An option that determines whether Bluetooth hands-free devices appear as\navailable input routes."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616518-allowbluetooth"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"allowbluetootha2dp"},(0,a.kt)("inlineCode",{parentName:"h2"},"AllowBluetoothA2DP")),(0,a.kt)("p",null,"An option that determines whether you can stream audio from this session\nto Bluetooth devices that support the Advanced Audio Distribution Profile (A2DP)."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1771735-allowbluetootha2dp"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"allowairplay"},(0,a.kt)("inlineCode",{parentName:"h2"},"AllowAirPlay")),(0,a.kt)("p",null,"An option that determines whether you can stream audio from this session\nto AirPlay devices."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1771736-allowairplay"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"defaulttospeaker"},(0,a.kt)("inlineCode",{parentName:"h2"},"DefaultToSpeaker")),(0,a.kt)("p",null,"An option that determines whether audio from the session defaults to the\nbuilt-in speaker instead of the receiver."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616462-defaulttospeaker"},"See the Apple Docs ")))}h.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/120b0a90.eeb70b29.js b/assets/js/49b2413b.b2f6271a.js similarity index 94% rename from assets/js/120b0a90.eeb70b29.js rename to assets/js/49b2413b.b2f6271a.js index 349096941..8219231d0 100644 --- a/assets/js/120b0a90.eeb70b29.js +++ b/assets/js/49b2413b.b2f6271a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[3632],{3905:function(e,t,o){o.d(t,{Zo:function(){return l},kt:function(){return m}});var a=o(7294);function n(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function i(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,a)}return o}function r(e){for(var t=1;t=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}var c=a.createContext({}),d=function(e){var t=a.useContext(c),o=t;return e&&(o="function"==typeof e?e(t):r(r({},t),e)),o},l=function(e){var t=d(e.components);return a.createElement(c.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var o=e.components,n=e.mdxType,i=e.originalType,c=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),u=d(o),m=n,h=u["".concat(c,".").concat(m)]||u[m]||s[m]||i;return o?a.createElement(h,r(r({ref:t},l),{},{components:o})):a.createElement(h,r({ref:t},l))}));function m(e,t){var o=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=o.length,r=new Array(i);r[0]=u;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p.mdxType="string"==typeof e?e:n,r[1]=p;for(var d=2;dDefault",id:"default",level:2},{value:"GameChat",id:"gamechat",level:2},{value:"Measurement",id:"measurement",level:2},{value:"MoviePlayback",id:"movieplayback",level:2},{value:"SpokenAudio",id:"spokenaudio",level:2},{value:"VideoChat",id:"videochat",level:2},{value:"VideoRecording",id:"videorecording",level:2},{value:"VoiceChat",id:"voicechat",level:2},{value:"VoicePrompt",id:"voiceprompt",level:2}],u={toc:s};function m(e){var t=e.components,o=(0,n.Z)(e,r);return(0,i.kt)("wrapper",(0,a.Z)({},u,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"ios-category-mode-ios-only"},"iOS Category Mode (ios-only)"),(0,i.kt)("p",null,"All iOS Category Mode types are made available through the named export ",(0,i.kt)("inlineCode",{parentName:"p"},"IOSCategoryMode"),":"),(0,i.kt)("h2",{id:"default"},(0,i.kt)("inlineCode",{parentName:"h2"},"Default")),(0,i.kt)("p",null,"The default audio session mode."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616579-default"},"See the Apple Docs")),(0,i.kt)("h2",{id:"gamechat"},(0,i.kt)("inlineCode",{parentName:"h2"},"GameChat")),(0,i.kt)("p",null,"A mode that the GameKit framework sets on behalf of an application that\nuses GameKit\u2019s voice chat service."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616511-gamechat"},"See the Apple Docs")),(0,i.kt)("h2",{id:"measurement"},(0,i.kt)("inlineCode",{parentName:"h2"},"Measurement")),(0,i.kt)("p",null,"A mode that indicates that your app is performing measurement of audio\ninput or output."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616608-measurement"},"See the Apple Docs")),(0,i.kt)("h2",{id:"movieplayback"},(0,i.kt)("inlineCode",{parentName:"h2"},"MoviePlayback")),(0,i.kt)("p",null,"A mode that indicates that your app is playing back movie content."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616623-movieplayback"},"See the Apple Docs")),(0,i.kt)("h2",{id:"spokenaudio"},(0,i.kt)("inlineCode",{parentName:"h2"},"SpokenAudio")),(0,i.kt)("p",null,"A mode used for continuous spoken audio to pause the audio when another\napp plays a short audio prompt."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616510-spokenaudio"},"See the Apple Docs")),(0,i.kt)("h2",{id:"videochat"},(0,i.kt)("inlineCode",{parentName:"h2"},"VideoChat")),(0,i.kt)("p",null,"A mode that indicates that your app is engaging in online video conferencing."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616590-videochat"},"See the Apple Docs")),(0,i.kt)("h2",{id:"videorecording"},(0,i.kt)("inlineCode",{parentName:"h2"},"VideoRecording")),(0,i.kt)("p",null,"A mode that indicates that your app is recording a movie."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616535-videorecording"},"See the Apple Docs")),(0,i.kt)("h2",{id:"voicechat"},(0,i.kt)("inlineCode",{parentName:"h2"},"VoiceChat")),(0,i.kt)("p",null,"A mode that indicates that your app is performing two-way voice communication,\nsuch as using Voice over Internet Protocol (VoIP)."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616455-voicechat"},"See the Apple Docs")),(0,i.kt)("h2",{id:"voiceprompt"},(0,i.kt)("inlineCode",{parentName:"h2"},"VoicePrompt")),(0,i.kt)("p",null,"A mode that indicates that your app plays audio using text-to-speech."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/2962803-voiceprompt"},"See the Apple Docs")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[5572],{3905:function(e,t,o){o.d(t,{Zo:function(){return l},kt:function(){return m}});var a=o(7294);function n(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function i(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,a)}return o}function r(e){for(var t=1;t=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}var c=a.createContext({}),d=function(e){var t=a.useContext(c),o=t;return e&&(o="function"==typeof e?e(t):r(r({},t),e)),o},l=function(e){var t=d(e.components);return a.createElement(c.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var o=e.components,n=e.mdxType,i=e.originalType,c=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),u=d(o),m=n,h=u["".concat(c,".").concat(m)]||u[m]||s[m]||i;return o?a.createElement(h,r(r({ref:t},l),{},{components:o})):a.createElement(h,r({ref:t},l))}));function m(e,t){var o=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=o.length,r=new Array(i);r[0]=u;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p.mdxType="string"==typeof e?e:n,r[1]=p;for(var d=2;dDefault",id:"default",level:2},{value:"GameChat",id:"gamechat",level:2},{value:"Measurement",id:"measurement",level:2},{value:"MoviePlayback",id:"movieplayback",level:2},{value:"SpokenAudio",id:"spokenaudio",level:2},{value:"VideoChat",id:"videochat",level:2},{value:"VideoRecording",id:"videorecording",level:2},{value:"VoiceChat",id:"voicechat",level:2},{value:"VoicePrompt",id:"voiceprompt",level:2}],u={toc:s};function m(e){var t=e.components,o=(0,n.Z)(e,r);return(0,i.kt)("wrapper",(0,a.Z)({},u,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"ios-category-mode-ios-only"},"iOS Category Mode (ios-only)"),(0,i.kt)("p",null,"All iOS Category Mode types are made available through the named export ",(0,i.kt)("inlineCode",{parentName:"p"},"IOSCategoryMode"),":"),(0,i.kt)("h2",{id:"default"},(0,i.kt)("inlineCode",{parentName:"h2"},"Default")),(0,i.kt)("p",null,"The default audio session mode."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616579-default"},"See the Apple Docs")),(0,i.kt)("h2",{id:"gamechat"},(0,i.kt)("inlineCode",{parentName:"h2"},"GameChat")),(0,i.kt)("p",null,"A mode that the GameKit framework sets on behalf of an application that\nuses GameKit\u2019s voice chat service."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616511-gamechat"},"See the Apple Docs")),(0,i.kt)("h2",{id:"measurement"},(0,i.kt)("inlineCode",{parentName:"h2"},"Measurement")),(0,i.kt)("p",null,"A mode that indicates that your app is performing measurement of audio\ninput or output."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616608-measurement"},"See the Apple Docs")),(0,i.kt)("h2",{id:"movieplayback"},(0,i.kt)("inlineCode",{parentName:"h2"},"MoviePlayback")),(0,i.kt)("p",null,"A mode that indicates that your app is playing back movie content."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616623-movieplayback"},"See the Apple Docs")),(0,i.kt)("h2",{id:"spokenaudio"},(0,i.kt)("inlineCode",{parentName:"h2"},"SpokenAudio")),(0,i.kt)("p",null,"A mode used for continuous spoken audio to pause the audio when another\napp plays a short audio prompt."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616510-spokenaudio"},"See the Apple Docs")),(0,i.kt)("h2",{id:"videochat"},(0,i.kt)("inlineCode",{parentName:"h2"},"VideoChat")),(0,i.kt)("p",null,"A mode that indicates that your app is engaging in online video conferencing."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616590-videochat"},"See the Apple Docs")),(0,i.kt)("h2",{id:"videorecording"},(0,i.kt)("inlineCode",{parentName:"h2"},"VideoRecording")),(0,i.kt)("p",null,"A mode that indicates that your app is recording a movie."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616535-videorecording"},"See the Apple Docs")),(0,i.kt)("h2",{id:"voicechat"},(0,i.kt)("inlineCode",{parentName:"h2"},"VoiceChat")),(0,i.kt)("p",null,"A mode that indicates that your app is performing two-way voice communication,\nsuch as using Voice over Internet Protocol (VoIP)."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/1616455-voicechat"},"See the Apple Docs")),(0,i.kt)("h2",{id:"voiceprompt"},(0,i.kt)("inlineCode",{parentName:"h2"},"VoicePrompt")),(0,i.kt)("p",null,"A mode that indicates that your app plays audio using text-to-speech."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/mode/2962803-voiceprompt"},"See the Apple Docs")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/578de3c1.37565125.js b/assets/js/578de3c1.37565125.js new file mode 100644 index 000000000..ff362dc52 --- /dev/null +++ b/assets/js/578de3c1.37565125.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[4664],{3905:function(t,e,n){n.d(e,{Zo:function(){return c},kt:function(){return s}});var r=n(7294);function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e=0||(a[n]=t[n]);return a}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}var p=r.createContext({}),d=function(t){var e=r.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):i(i({},e),t)),n},c=function(t){var e=d(t.components);return r.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},u=r.forwardRef((function(t,e){var n=t.components,a=t.mdxType,l=t.originalType,p=t.parentName,c=o(t,["components","mdxType","originalType","parentName"]),u=d(n),s=a,k=u["".concat(p,".").concat(s)]||u[s]||m[s]||l;return n?r.createElement(k,i(i({ref:e},c),{},{components:n})):r.createElement(k,i({ref:e},c))}));function s(t,e){var n=arguments,a=e&&e.mdxType;if("string"==typeof t||a){var l=n.length,i=new Array(l);i[0]=u;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:a,i[1]=o;for(var d=2;d=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=n.createContext({}),u=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},p=function(e){var r=u(e.components);return n.createElement(s.Provider,{value:r},e.children)},l={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,c=e.originalType,s=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),f=u(t),m=o,d=f["".concat(s,".").concat(m)]||f[m]||l[m]||c;return t?n.createElement(d,i(i({ref:r},p),{},{components:t})):n.createElement(d,i({ref:r},p))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var c=t.length,i=new Array(c);i[0]=f;var a={};for(var s in r)hasOwnProperty.call(r,s)&&(a[s]=r[s]);a.originalType=e,a.mdxType="string"==typeof e?e:o,i[1]=a;for(var u=2;u=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=n.createContext({}),u=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},p=function(e){var r=u(e.components);return n.createElement(s.Provider,{value:r},e.children)},l={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,c=e.originalType,s=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),f=u(t),m=o,d=f["".concat(s,".").concat(m)]||f[m]||l[m]||c;return t?n.createElement(d,i(i({ref:r},p),{},{components:t})):n.createElement(d,i({ref:r},p))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var c=t.length,i=new Array(c);i[0]=f;var a={};for(var s in r)hasOwnProperty.call(r,s)&&(a[s]=r[s]);a.originalType=e,a.mdxType="string"==typeof e?e:o,i[1]=a;for(var u=2;u=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(t),m=o,f=u["".concat(s,".").concat(m)]||u[m]||c[m]||a;return t?r.createElement(f,i(i({ref:n},d),{},{components:t})):r.createElement(f,i({ref:n},d))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;pstopWithApp is now android.appKilledPlaybackBehavior",id:"stopwithapp-is-now-androidappkilledplaybackbehavior",level:3},{value:"destroy and stop have been removed",id:"destroy-and-stop-have-been-removed",level:3},{value:"Configuration Changes",id:"configuration-changes",level:2},{value:"track-player.json / Build Preferences no longer needed",id:"track-playerjson--build-preferences-no-longer-needed",level:3},{value:"Minimum Compile/Target SDK",id:"minimum-compiletarget-sdk",level:3}],u={toc:c};function m(e){var n=e.components,t=(0,o.Z)(e,i);return(0,a.kt)("wrapper",(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"migrating-from-v2-to-v3"},"Migrating from v2 to v3"),(0,a.kt)("p",null,"Due to how Android handles foreground services, it's not possible for us to stop the process manually, as it's waiting for the foreground service to come back. With v3 we are introducing the following changes related to this:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"On Android, the audio service can't be manually stopped by the app anymore.\nThe OS itself decides when to stop it."),(0,a.kt)("li",{parentName:"ul"},"An audio control notification will ",(0,a.kt)("em",{parentName:"li"},"always")," be present (depending on phone\nvendor, this would look and behave differently), which allows users to\nquickly go back to the app by tapping on it.")),(0,a.kt)("p",null,"The full changelog of added features and bug fixes ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/doublesymmetry/react-native-track-player/releases/tag/v3.0"},"can be found here"),"."),(0,a.kt)("p",null,"When migrating from v2 to v3, the following has changed:"),(0,a.kt)("h2",{id:"api-changes"},"API Changes"),(0,a.kt)("h3",{id:"stopwithapp-is-now-androidappkilledplaybackbehavior"},(0,a.kt)("inlineCode",{parentName:"h3"},"stopWithApp")," is now ",(0,a.kt)("inlineCode",{parentName:"h3"},"android.appKilledPlaybackBehavior")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"// Methods\nawait TrackPlayer.updateOptions({\n- stopWithApp: true,\n+ android: {\n+ appKilledPlaybackBehavior: AppKilledPlaybackBehavior.ContinuePlayback\n+ }\n});\n")),(0,a.kt)("h3",{id:"destroy-and-stop-have-been-removed"},(0,a.kt)("inlineCode",{parentName:"h3"},"destroy")," and ",(0,a.kt)("inlineCode",{parentName:"h3"},"stop")," have been removed"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"// remove all usages of `.destroy()` and `.stop()`\n- TrackPlayer.destroy();\n- TrackPlayer.stop();\n")),(0,a.kt)("h2",{id:"configuration-changes"},"Configuration Changes"),(0,a.kt)("h3",{id:"track-playerjson--build-preferences-no-longer-needed"},(0,a.kt)("inlineCode",{parentName:"h3"},"track-player.json")," / Build Preferences no longer needed"),(0,a.kt)("p",null,"HLS, Dash, & Smoothstreaming are now supported on Android out of the box. You\ncan remove your ",(0,a.kt)("inlineCode",{parentName:"p"},"track-player.json")," file if you have one. You still need to\nensure that ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/objects/track"},"the correct ",(0,a.kt)("inlineCode",{parentName:"a"},"type")," is specified on your ",(0,a.kt)("inlineCode",{parentName:"a"},"Track"),"\nobject"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- track-player.json\n")),(0,a.kt)("h3",{id:"minimum-compiletarget-sdk"},"Minimum Compile/Target SDK"),(0,a.kt)("p",null,"You also need to have a minimum compile & target SDK of 31 (Android 12)"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-groovy"},"// android/build.gradle\n...\n compileSdkVersion = 31\n targetSdkVersion = 31\n...\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/60066cbc.88864636.js b/assets/js/60066cbc.88864636.js new file mode 100644 index 000000000..eb177b139 --- /dev/null +++ b/assets/js/60066cbc.88864636.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[7025],{3905:function(e,t,a){a.d(t,{Zo:function(){return d},kt:function(){return m}});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},d=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=s(a),m=r,k=c["".concat(p,".").concat(m)]||c[m]||u[m]||i;return a?n.createElement(k,o(o({ref:t},d),{},{components:a})):n.createElement(k,o({ref:t},d))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=c;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var s=2;s=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),o=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},k=function(e){var t=o(e.components);return n.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,k=d(e,["components","mdxType","originalType","parentName"]),u=o(a),s=r,c=u["".concat(p,".").concat(s)]||u[s]||m[s]||l;return a?n.createElement(c,i(i({ref:t},k),{},{components:a})):n.createElement(c,i({ref:t},k))}));function s(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=u;var d={};for(var p in t)hasOwnProperty.call(t,p)&&(d[p]=t[p]);d.originalType=e,d.mdxType="string"==typeof e?e:r,i[1]=d;for(var o=2;oPlaybackState",id:"playbackstate",level:3},{value:"PlaybackActiveTrackChanged",id:"playbackactivetrackchanged",level:3},{value:"PlaybackQueueEnded",id:"playbackqueueended",level:3},{value:"PlaybackMetadataReceived",id:"playbackmetadatareceived",level:3},{value:"PlaybackProgressUpdated",id:"playbackprogressupdated",level:3},{value:"PlaybackError",id:"playbackerror",level:3},{value:"PlaybackPlayWhenReadyChanged",id:"playbackplaywhenreadychanged",level:3},{value:"\u26a0\ufe0fPlaybackTrackChanged",id:"\ufe0fplaybacktrackchanged",level:3},{value:"Media Controls",id:"media-controls",level:2},{value:"RemotePlay",id:"remoteplay",level:3},{value:"RemotePlayId",id:"remoteplayid",level:3},{value:"RemotePlaySearch",id:"remoteplaysearch",level:3},{value:"RemotePause",id:"remotepause",level:3},{value:"RemoteStop",id:"remotestop",level:3},{value:"RemoteSkip",id:"remoteskip",level:3},{value:"RemoteNext",id:"remotenext",level:3},{value:"RemotePrevious",id:"remoteprevious",level:3},{value:"RemoteSeek",id:"remoteseek",level:3},{value:"RemoteSetRating",id:"remotesetrating",level:3},{value:"RemoteJumpForward",id:"remotejumpforward",level:3},{value:"RemoteJumpBackward",id:"remotejumpbackward",level:3},{value:"RemoteLike (iOS only)",id:"remotelike-ios-only",level:3},{value:"RemoteDislike (iOS only)",id:"remotedislike-ios-only",level:3},{value:"RemoteBookmark (iOS only)",id:"remotebookmark-ios-only",level:3},{value:"RemoteDuck",id:"remoteduck",level:3},{value:"Metadata",id:"metadata",level:2},{value:"AudioCommonMetadataReceived",id:"audiocommonmetadatareceived",level:3},{value:"AudioTimedMetadataReceived",id:"audiotimedmetadatareceived",level:3},{value:"AudioChapterMetadataReceived (iOS only)",id:"audiochaptermetadatareceived-ios-only",level:3}],u={toc:m};function s(e){var t=e.components,a=(0,r.Z)(e,i);return(0,l.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"events"},"Events"),(0,l.kt)("p",null,"All event types are made available through the named export ",(0,l.kt)("inlineCode",{parentName:"p"},"Event"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},"import { Event } from 'react-native-track-player';\n")),(0,l.kt)("h2",{id:"player"},"Player"),(0,l.kt)("h3",{id:"playbackstate"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackState")),(0,l.kt)("p",null,"Fired when the state of the player changes."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"state"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("a",{parentName:"td",href:"/docs/api/constants/state"},"State")),(0,l.kt)("td",{parentName:"tr",align:null},"The new state")))),(0,l.kt)("h3",{id:"playbackactivetrackchanged"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackActiveTrackChanged")),(0,l.kt)("p",null,"The new event also includes the full track objects for the newly active and last tracks."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"lastIndex"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")),(0,l.kt)("td",{parentName:"tr",align:null},"The index of previously active track.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"lastTrack"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"Track")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")),(0,l.kt)("td",{parentName:"tr",align:null},"The previously active track or ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")," when there wasn't a previously active track.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"lastPosition"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The position of the previously active track in seconds.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"index"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")),(0,l.kt)("td",{parentName:"tr",align:null},"The newly active track index or ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")," if there is no longer an active track.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"track"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"Track")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")),(0,l.kt)("td",{parentName:"tr",align:null},"The newly active track or ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")," if there is no longer an active track.")))),(0,l.kt)("h3",{id:"playbackqueueended"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackQueueEnded")),(0,l.kt)("p",null,"Fired when the queue reaches the end."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"track"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The previous track index. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"position"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The previous track position in seconds")))),(0,l.kt)("h3",{id:"playbackmetadatareceived"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackMetadataReceived")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated:")," Please use ",(0,l.kt)("inlineCode",{parentName:"p"},"AudioChapterMetadataReceived"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"AudioTimedMetadataReceived"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"AudioCommonMetadataReceived"),"."),(0,l.kt)("p",null,"Fired when the current track receives metadata encoded in. (e.g. ID3 tags, Icy Metadata, Vorbis Comments or QuickTime metadata)."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"source"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The metadata source (",(0,l.kt)("inlineCode",{parentName:"td"},"id3"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"icy"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"icy-headers"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"vorbis-comment"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"quicktime"),")")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"title"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track title. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"url"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track url. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"artist"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track artist. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"album"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track album. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"date"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track date. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"genre"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track genre. Might be null")))),(0,l.kt)("h3",{id:"playbackprogressupdated"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackProgressUpdated")),(0,l.kt)("p",null,"\u26a0\ufe0f Note: This event is only emitted if you specify a non-zero ",(0,l.kt)("inlineCode",{parentName:"p"},"progressUpdateEventInterval")," value in your player options."),(0,l.kt)("p",null,"Fired at the ",(0,l.kt)("inlineCode",{parentName:"p"},"progressUpdateEventInterval")," if the player is playing ",(0,l.kt)("em",{parentName:"p"},"and")," if a ",(0,l.kt)("inlineCode",{parentName:"p"},"progressUpdateEventInterval")," has been specified."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"position"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"See ",(0,l.kt)("a",{parentName:"td",href:"/docs/api/functions/player#getProgress"},(0,l.kt)("inlineCode",{parentName:"a"},"getProgress")))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"duration"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"See ",(0,l.kt)("a",{parentName:"td",href:"/docs/api/functions/player#getProgress"},(0,l.kt)("inlineCode",{parentName:"a"},"getProgress")))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"buffered"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"See ",(0,l.kt)("a",{parentName:"td",href:"/docs/api/functions/player#getProgress"},(0,l.kt)("inlineCode",{parentName:"a"},"getProgress")))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"track"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The current index in the queue of the track.")))),(0,l.kt)("h3",{id:"playbackerror"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackError")),(0,l.kt)("p",null,"Fired when an error occurs."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"code"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The error code")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"message"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The error message")))),(0,l.kt)("h3",{id:"playbackplaywhenreadychanged"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackPlayWhenReadyChanged")),(0,l.kt)("p",null,"Fired when the ",(0,l.kt)("inlineCode",{parentName:"p"},"playWhenReady")," property is changed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"playWhenReady"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"boolean")),(0,l.kt)("td",{parentName:"tr",align:null},"The current value of ",(0,l.kt)("inlineCode",{parentName:"td"},"playWhenReady"))))),(0,l.kt)("h3",{id:"\ufe0fplaybacktrackchanged"},"\u26a0\ufe0f",(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackTrackChanged")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated:")," Please use ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaybackActiveTrackChanged"),"."),(0,l.kt)("p",null,"Fired when a track is changed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"track"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The previous track index. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"position"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The previous track position in seconds")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"nextTrack"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The next track index. Might be null")))),(0,l.kt)("hr",null),(0,l.kt)("h2",{id:"media-controls"},"Media Controls"),(0,l.kt)("h3",{id:"remoteplay"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePlay")),(0,l.kt)("p",null,"Fired when the user presses the play button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.Play"))," is allowed."),(0,l.kt)("h3",{id:"remoteplayid"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePlayId")),(0,l.kt)("p",null,"Fired when the user selects a track from an external device. Required for Android Auto support. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.PlayFromId"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"id"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track id")))),(0,l.kt)("h3",{id:"remoteplaysearch"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePlaySearch")),(0,l.kt)("p",null,"Fired when the user searches for a track (usually voice search). Required for Android Auto support. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.PlayFromSearch"))," is allowed."),(0,l.kt)("p",null,"Every parameter except ",(0,l.kt)("inlineCode",{parentName:"p"},"query")," is optional and may not be provided.\nIn the case where ",(0,l.kt)("inlineCode",{parentName:"p"},"query")," is empty, feel free to select any track to play."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"query"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The search query")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"focus"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The focus of the search. One of ",(0,l.kt)("inlineCode",{parentName:"td"},"artist"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"album"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"playlist")," or ",(0,l.kt)("inlineCode",{parentName:"td"},"genre"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"title"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track title")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"artist"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track artist")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"album"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track album")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"genre"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track genre")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"playlist"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track playlist")))),(0,l.kt)("h3",{id:"remotepause"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePause")),(0,l.kt)("p",null,"Fired when the user presses the pause button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.Pause"))," is allowed or if there's a change in outputs (e.g.: headphone disconnected)."),(0,l.kt)("h3",{id:"remotestop"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteStop")),(0,l.kt)("p",null,"Fired when the user presses the stop button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.Stop"))," is allowed."),(0,l.kt)("h3",{id:"remoteskip"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteSkip")),(0,l.kt)("p",null,"Fired when the user skips to a track in the queue. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.Skip"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"index"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The track index")))),(0,l.kt)("h3",{id:"remotenext"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteNext")),(0,l.kt)("p",null,"Fired when the user presses the next track button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.SkipToNext"))," is allowed."),(0,l.kt)("h3",{id:"remoteprevious"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePrevious")),(0,l.kt)("p",null,"Fired when the user presses the previous track button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.SkipToPrevious"))," is allowed."),(0,l.kt)("h3",{id:"remoteseek"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteSeek")),(0,l.kt)("p",null,"Fired when the user changes the position of the timeline. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.SeekTo"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"position"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The position to seek to in seconds")))),(0,l.kt)("h3",{id:"remotesetrating"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteSetRating")),(0,l.kt)("p",null,"Fired when the user changes the rating for the track. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.SetRating"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"rating"),(0,l.kt)("td",{parentName:"tr",align:null},"Depends on the ",(0,l.kt)("a",{parentName:"td",href:"/docs/api/constants/rating"},"Rating Type")),(0,l.kt)("td",{parentName:"tr",align:null},"The rating that was set")))),(0,l.kt)("h3",{id:"remotejumpforward"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteJumpForward")),(0,l.kt)("p",null,"Fired when the user presses the jump forward button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.JumpForward"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"interval"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The number of seconds to jump forward. It's usually the ",(0,l.kt)("inlineCode",{parentName:"td"},"forwardJumpInterval")," set in the options.")))),(0,l.kt)("h3",{id:"remotejumpbackward"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteJumpBackward")),(0,l.kt)("p",null,"Fired when the user presses the jump backward button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.JumpBackward"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"interval"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The number of seconds to jump backward. It's usually the ",(0,l.kt)("inlineCode",{parentName:"td"},"backwardJumpInterval")," set in the options.")))),(0,l.kt)("h3",{id:"remotelike-ios-only"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteLike")," (iOS only)"),(0,l.kt)("p",null,"Fired when the user presses the like button in the now playing center. Only fired if the ",(0,l.kt)("inlineCode",{parentName:"p"},"likeOptions")," is set in ",(0,l.kt)("inlineCode",{parentName:"p"},"updateOptions"),"."),(0,l.kt)("h3",{id:"remotedislike-ios-only"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteDislike")," (iOS only)"),(0,l.kt)("p",null,"Fired when the user presses the dislike button in the now playing center. Only fired if the ",(0,l.kt)("inlineCode",{parentName:"p"},"dislikeOptions")," is set in ",(0,l.kt)("inlineCode",{parentName:"p"},"updateOptions"),"."),(0,l.kt)("h3",{id:"remotebookmark-ios-only"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteBookmark")," (iOS only)"),(0,l.kt)("p",null,"Fired when the user presses the bookmark button in the now playing center. Only fired if the ",(0,l.kt)("inlineCode",{parentName:"p"},"bookmarkOptions")," is set in ",(0,l.kt)("inlineCode",{parentName:"p"},"updateOptions"),"."),(0,l.kt)("h3",{id:"remoteduck"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteDuck")),(0,l.kt)("p",null,"Fired when the audio is interrupted. For example when a phone call arrives,\na clock or calender sounds, or another app starts playing audio."),(0,l.kt)("p",null,"We recommend to set ",(0,l.kt)("inlineCode",{parentName:"p"},"autoHandleInterruptions: true")," in\n",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.setupPlayer"),". This way toggling playback is handled automatically."),(0,l.kt)("p",null,"By default ",(0,l.kt)("inlineCode",{parentName:"p"},"autoHandleInterruptions")," is set to ",(0,l.kt)("inlineCode",{parentName:"p"},"false")," (default) in\n",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.setupPlayer"),", which means your app is expected to respond to this\nevent in the following situations:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"When the event is triggered with ",(0,l.kt)("inlineCode",{parentName:"li"},"paused")," set to ",(0,l.kt)("inlineCode",{parentName:"li"},"true"),", on Android playback\nshould be paused. When ",(0,l.kt)("inlineCode",{parentName:"li"},"permanent")," is also set to ",(0,l.kt)("inlineCode",{parentName:"li"},"true"),", on Android the\nplayer should stop playback."),(0,l.kt)("li",{parentName:"ul"},"When the event is triggered and ",(0,l.kt)("inlineCode",{parentName:"li"},"paused")," is set to ",(0,l.kt)("inlineCode",{parentName:"li"},"false"),", the player may\nresume playback.")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"paused"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"boolean")),(0,l.kt)("td",{parentName:"tr",align:null},"On Android when ",(0,l.kt)("inlineCode",{parentName:"td"},"true")," the player should pause playback, when ",(0,l.kt)("inlineCode",{parentName:"td"},"false")," the player may resume playback. On iOS when ",(0,l.kt)("inlineCode",{parentName:"td"},"true")," the playback was paused and when ",(0,l.kt)("inlineCode",{parentName:"td"},"false")," the player may resume playback.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"permanent"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"boolean")),(0,l.kt)("td",{parentName:"tr",align:null},"Whether the interruption is permanent. On Android the player should stop playback.")))),(0,l.kt)("h2",{id:"metadata"},"Metadata"),(0,l.kt)("h3",{id:"audiocommonmetadatareceived"},(0,l.kt)("inlineCode",{parentName:"h3"},"AudioCommonMetadataReceived")),(0,l.kt)("p",null,"Fired when the current track receives metadata encoded in - static metadata not tied to a time. Usually received at start."),(0,l.kt)("p",null,"Received data will be ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/metadata"},(0,l.kt)("inlineCode",{parentName:"a"},"AudioCommonMetadataReceivedEvent")),"."),(0,l.kt)("h3",{id:"audiotimedmetadatareceived"},(0,l.kt)("inlineCode",{parentName:"h3"},"AudioTimedMetadataReceived")),(0,l.kt)("p",null,"Fired when the current track receives metadata encoded in - dynamic metadata tied to a time. Events may be emitted over time."),(0,l.kt)("p",null,"Received data will be ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/metadata"},(0,l.kt)("inlineCode",{parentName:"a"},"AudioMetadataReceivedEvent")),"."),(0,l.kt)("h3",{id:"audiochaptermetadatareceived-ios-only"},(0,l.kt)("inlineCode",{parentName:"h3"},"AudioChapterMetadataReceived")," (iOS only)"),(0,l.kt)("p",null,"Fired when the current track receives metadata encoded in - chapter overview data. Usually received at start."),(0,l.kt)("p",null,"Received data will be ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/metadata"},(0,l.kt)("inlineCode",{parentName:"a"},"AudioMetadataReceivedEvent")),"."))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6ad07298.8098e091.js b/assets/js/6ad07298.8098e091.js new file mode 100644 index 000000000..7e8a4a381 --- /dev/null +++ b/assets/js/6ad07298.8098e091.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[7938],{3905:function(e,t,a){a.d(t,{Zo:function(){return k},kt:function(){return s}});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),o=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},k=function(e){var t=o(e.components);return n.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,k=d(e,["components","mdxType","originalType","parentName"]),u=o(a),s=r,c=u["".concat(p,".").concat(s)]||u[s]||m[s]||l;return a?n.createElement(c,i(i({ref:t},k),{},{components:a})):n.createElement(c,i({ref:t},k))}));function s(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=u;var d={};for(var p in t)hasOwnProperty.call(t,p)&&(d[p]=t[p]);d.originalType=e,d.mdxType="string"==typeof e?e:r,i[1]=d;for(var o=2;oPlaybackState",id:"playbackstate",level:3},{value:"PlaybackActiveTrackChanged",id:"playbackactivetrackchanged",level:3},{value:"PlaybackQueueEnded",id:"playbackqueueended",level:3},{value:"PlaybackMetadataReceived",id:"playbackmetadatareceived",level:3},{value:"PlaybackProgressUpdated",id:"playbackprogressupdated",level:3},{value:"PlaybackError",id:"playbackerror",level:3},{value:"PlaybackPlayWhenReadyChanged",id:"playbackplaywhenreadychanged",level:3},{value:"\u26a0\ufe0fPlaybackTrackChanged",id:"\ufe0fplaybacktrackchanged",level:3},{value:"Media Controls",id:"media-controls",level:2},{value:"RemotePlay",id:"remoteplay",level:3},{value:"RemotePlayId",id:"remoteplayid",level:3},{value:"RemotePlaySearch",id:"remoteplaysearch",level:3},{value:"RemotePause",id:"remotepause",level:3},{value:"RemoteStop",id:"remotestop",level:3},{value:"RemoteSkip",id:"remoteskip",level:3},{value:"RemoteNext",id:"remotenext",level:3},{value:"RemotePrevious",id:"remoteprevious",level:3},{value:"RemoteSeek",id:"remoteseek",level:3},{value:"RemoteSetRating",id:"remotesetrating",level:3},{value:"RemoteJumpForward",id:"remotejumpforward",level:3},{value:"RemoteJumpBackward",id:"remotejumpbackward",level:3},{value:"RemoteLike (iOS only)",id:"remotelike-ios-only",level:3},{value:"RemoteDislike (iOS only)",id:"remotedislike-ios-only",level:3},{value:"RemoteBookmark (iOS only)",id:"remotebookmark-ios-only",level:3},{value:"RemoteDuck",id:"remoteduck",level:3},{value:"Metadata",id:"metadata",level:2},{value:"AudioCommonMetadataReceived",id:"audiocommonmetadatareceived",level:3},{value:"AudioTimedMetadataReceived",id:"audiotimedmetadatareceived",level:3},{value:"AudioChapterMetadataReceived (iOS only)",id:"audiochaptermetadatareceived-ios-only",level:3}],u={toc:m};function s(e){var t=e.components,a=(0,r.Z)(e,i);return(0,l.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"events"},"Events"),(0,l.kt)("p",null,"All event types are made available through the named export ",(0,l.kt)("inlineCode",{parentName:"p"},"Event"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},"import { Event } from 'react-native-track-player';\n")),(0,l.kt)("h2",{id:"player"},"Player"),(0,l.kt)("h3",{id:"playbackstate"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackState")),(0,l.kt)("p",null,"Fired when the state of the player changes."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"state"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("a",{parentName:"td",href:"/docs/4.0/api/constants/state"},"State")),(0,l.kt)("td",{parentName:"tr",align:null},"The new state")))),(0,l.kt)("h3",{id:"playbackactivetrackchanged"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackActiveTrackChanged")),(0,l.kt)("p",null,"The new event also includes the full track objects for the newly active and last tracks."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"lastIndex"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")),(0,l.kt)("td",{parentName:"tr",align:null},"The index of previously active track.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"lastTrack"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"Track")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")),(0,l.kt)("td",{parentName:"tr",align:null},"The previously active track or ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")," when there wasn't a previously active track.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"lastPosition"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The position of the previously active track in seconds.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"index"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")),(0,l.kt)("td",{parentName:"tr",align:null},"The newly active track index or ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")," if there is no longer an active track.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"track"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"Track")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")),(0,l.kt)("td",{parentName:"tr",align:null},"The newly active track or ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")," if there is no longer an active track.")))),(0,l.kt)("h3",{id:"playbackqueueended"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackQueueEnded")),(0,l.kt)("p",null,"Fired when the queue reaches the end."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"track"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The previous track index. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"position"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The previous track position in seconds")))),(0,l.kt)("h3",{id:"playbackmetadatareceived"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackMetadataReceived")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated:")," Please use ",(0,l.kt)("inlineCode",{parentName:"p"},"AudioChapterMetadataReceived"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"AudioTimedMetadataReceived"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"AudioCommonMetadataReceived"),"."),(0,l.kt)("p",null,"Fired when the current track receives metadata encoded in. (e.g. ID3 tags, Icy Metadata, Vorbis Comments or QuickTime metadata)."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"source"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The metadata source (",(0,l.kt)("inlineCode",{parentName:"td"},"id3"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"icy"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"icy-headers"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"vorbis-comment"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"quicktime"),")")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"title"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track title. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"url"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track url. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"artist"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track artist. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"album"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track album. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"date"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track date. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"genre"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track genre. Might be null")))),(0,l.kt)("h3",{id:"playbackprogressupdated"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackProgressUpdated")),(0,l.kt)("p",null,"\u26a0\ufe0f Note: This event is only emitted if you specify a non-zero ",(0,l.kt)("inlineCode",{parentName:"p"},"progressUpdateEventInterval")," value in your player options."),(0,l.kt)("p",null,"Fired at the ",(0,l.kt)("inlineCode",{parentName:"p"},"progressUpdateEventInterval")," if the player is playing ",(0,l.kt)("em",{parentName:"p"},"and")," if a ",(0,l.kt)("inlineCode",{parentName:"p"},"progressUpdateEventInterval")," has been specified."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"position"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"See ",(0,l.kt)("a",{parentName:"td",href:"/docs/4.0/api/functions/player#getProgress"},(0,l.kt)("inlineCode",{parentName:"a"},"getProgress")))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"duration"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"See ",(0,l.kt)("a",{parentName:"td",href:"/docs/4.0/api/functions/player#getProgress"},(0,l.kt)("inlineCode",{parentName:"a"},"getProgress")))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"buffered"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"See ",(0,l.kt)("a",{parentName:"td",href:"/docs/4.0/api/functions/player#getProgress"},(0,l.kt)("inlineCode",{parentName:"a"},"getProgress")))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"track"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The current index in the queue of the track.")))),(0,l.kt)("h3",{id:"playbackerror"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackError")),(0,l.kt)("p",null,"Fired when an error occurs."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"code"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The error code")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"message"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The error message")))),(0,l.kt)("h3",{id:"playbackplaywhenreadychanged"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackPlayWhenReadyChanged")),(0,l.kt)("p",null,"Fired when the ",(0,l.kt)("inlineCode",{parentName:"p"},"playWhenReady")," property is changed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"playWhenReady"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"boolean")),(0,l.kt)("td",{parentName:"tr",align:null},"The current value of ",(0,l.kt)("inlineCode",{parentName:"td"},"playWhenReady"))))),(0,l.kt)("h3",{id:"\ufe0fplaybacktrackchanged"},"\u26a0\ufe0f",(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackTrackChanged")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated:")," Please use ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaybackActiveTrackChanged"),"."),(0,l.kt)("p",null,"Fired when a track is changed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"track"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The previous track index. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"position"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The previous track position in seconds")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"nextTrack"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The next track index. Might be null")))),(0,l.kt)("hr",null),(0,l.kt)("h2",{id:"media-controls"},"Media Controls"),(0,l.kt)("h3",{id:"remoteplay"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePlay")),(0,l.kt)("p",null,"Fired when the user presses the play button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.Play"))," is allowed."),(0,l.kt)("h3",{id:"remoteplayid"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePlayId")),(0,l.kt)("p",null,"Fired when the user selects a track from an external device. Required for Android Auto support. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.PlayFromId"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"id"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track id")))),(0,l.kt)("h3",{id:"remoteplaysearch"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePlaySearch")),(0,l.kt)("p",null,"Fired when the user searches for a track (usually voice search). Required for Android Auto support. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.PlayFromSearch"))," is allowed."),(0,l.kt)("p",null,"Every parameter except ",(0,l.kt)("inlineCode",{parentName:"p"},"query")," is optional and may not be provided.\nIn the case where ",(0,l.kt)("inlineCode",{parentName:"p"},"query")," is empty, feel free to select any track to play."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"query"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The search query")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"focus"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The focus of the search. One of ",(0,l.kt)("inlineCode",{parentName:"td"},"artist"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"album"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"playlist")," or ",(0,l.kt)("inlineCode",{parentName:"td"},"genre"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"title"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track title")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"artist"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track artist")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"album"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track album")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"genre"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track genre")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"playlist"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track playlist")))),(0,l.kt)("h3",{id:"remotepause"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePause")),(0,l.kt)("p",null,"Fired when the user presses the pause button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.Pause"))," is allowed or if there's a change in outputs (e.g.: headphone disconnected)."),(0,l.kt)("h3",{id:"remotestop"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteStop")),(0,l.kt)("p",null,"Fired when the user presses the stop button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.Stop"))," is allowed."),(0,l.kt)("h3",{id:"remoteskip"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteSkip")),(0,l.kt)("p",null,"Fired when the user skips to a track in the queue. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.Skip"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"index"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The track index")))),(0,l.kt)("h3",{id:"remotenext"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteNext")),(0,l.kt)("p",null,"Fired when the user presses the next track button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.SkipToNext"))," is allowed."),(0,l.kt)("h3",{id:"remoteprevious"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePrevious")),(0,l.kt)("p",null,"Fired when the user presses the previous track button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.SkipToPrevious"))," is allowed."),(0,l.kt)("h3",{id:"remoteseek"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteSeek")),(0,l.kt)("p",null,"Fired when the user changes the position of the timeline. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.SeekTo"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"position"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The position to seek to in seconds")))),(0,l.kt)("h3",{id:"remotesetrating"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteSetRating")),(0,l.kt)("p",null,"Fired when the user changes the rating for the track. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.SetRating"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"rating"),(0,l.kt)("td",{parentName:"tr",align:null},"Depends on the ",(0,l.kt)("a",{parentName:"td",href:"/docs/4.0/api/constants/rating"},"Rating Type")),(0,l.kt)("td",{parentName:"tr",align:null},"The rating that was set")))),(0,l.kt)("h3",{id:"remotejumpforward"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteJumpForward")),(0,l.kt)("p",null,"Fired when the user presses the jump forward button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.JumpForward"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"interval"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The number of seconds to jump forward. It's usually the ",(0,l.kt)("inlineCode",{parentName:"td"},"forwardJumpInterval")," set in the options.")))),(0,l.kt)("h3",{id:"remotejumpbackward"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteJumpBackward")),(0,l.kt)("p",null,"Fired when the user presses the jump backward button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.JumpBackward"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"interval"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The number of seconds to jump backward. It's usually the ",(0,l.kt)("inlineCode",{parentName:"td"},"backwardJumpInterval")," set in the options.")))),(0,l.kt)("h3",{id:"remotelike-ios-only"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteLike")," (iOS only)"),(0,l.kt)("p",null,"Fired when the user presses the like button in the now playing center. Only fired if the ",(0,l.kt)("inlineCode",{parentName:"p"},"likeOptions")," is set in ",(0,l.kt)("inlineCode",{parentName:"p"},"updateOptions"),"."),(0,l.kt)("h3",{id:"remotedislike-ios-only"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteDislike")," (iOS only)"),(0,l.kt)("p",null,"Fired when the user presses the dislike button in the now playing center. Only fired if the ",(0,l.kt)("inlineCode",{parentName:"p"},"dislikeOptions")," is set in ",(0,l.kt)("inlineCode",{parentName:"p"},"updateOptions"),"."),(0,l.kt)("h3",{id:"remotebookmark-ios-only"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteBookmark")," (iOS only)"),(0,l.kt)("p",null,"Fired when the user presses the bookmark button in the now playing center. Only fired if the ",(0,l.kt)("inlineCode",{parentName:"p"},"bookmarkOptions")," is set in ",(0,l.kt)("inlineCode",{parentName:"p"},"updateOptions"),"."),(0,l.kt)("h3",{id:"remoteduck"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteDuck")),(0,l.kt)("p",null,"Fired when the audio is interrupted. For example when a phone call arrives,\na clock or calender sounds, or another app starts playing audio."),(0,l.kt)("p",null,"We recommend to set ",(0,l.kt)("inlineCode",{parentName:"p"},"autoHandleInterruptions: true")," in\n",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.setupPlayer"),". This way toggling playback is handled automatically."),(0,l.kt)("p",null,"By default ",(0,l.kt)("inlineCode",{parentName:"p"},"autoHandleInterruptions")," is set to ",(0,l.kt)("inlineCode",{parentName:"p"},"false")," (default) in\n",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.setupPlayer"),", which means your app is expected to respond to this\nevent in the following situations:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"When the event is triggered with ",(0,l.kt)("inlineCode",{parentName:"li"},"paused")," set to ",(0,l.kt)("inlineCode",{parentName:"li"},"true"),", on Android playback\nshould be paused. When ",(0,l.kt)("inlineCode",{parentName:"li"},"permanent")," is also set to ",(0,l.kt)("inlineCode",{parentName:"li"},"true"),", on Android the\nplayer should stop playback."),(0,l.kt)("li",{parentName:"ul"},"When the event is triggered and ",(0,l.kt)("inlineCode",{parentName:"li"},"paused")," is set to ",(0,l.kt)("inlineCode",{parentName:"li"},"false"),", the player may\nresume playback.")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"paused"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"boolean")),(0,l.kt)("td",{parentName:"tr",align:null},"On Android when ",(0,l.kt)("inlineCode",{parentName:"td"},"true")," the player should pause playback, when ",(0,l.kt)("inlineCode",{parentName:"td"},"false")," the player may resume playback. On iOS when ",(0,l.kt)("inlineCode",{parentName:"td"},"true")," the playback was paused and when ",(0,l.kt)("inlineCode",{parentName:"td"},"false")," the player may resume playback.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"permanent"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"boolean")),(0,l.kt)("td",{parentName:"tr",align:null},"Whether the interruption is permanent. On Android the player should stop playback.")))),(0,l.kt)("h2",{id:"metadata"},"Metadata"),(0,l.kt)("h3",{id:"audiocommonmetadatareceived"},(0,l.kt)("inlineCode",{parentName:"h3"},"AudioCommonMetadataReceived")),(0,l.kt)("p",null,"Fired when the current track receives metadata encoded in - static metadata not tied to a time. Usually received at start."),(0,l.kt)("p",null,"Received data will be ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/metadata"},(0,l.kt)("inlineCode",{parentName:"a"},"AudioCommonMetadataReceivedEvent")),"."),(0,l.kt)("h3",{id:"audiotimedmetadatareceived"},(0,l.kt)("inlineCode",{parentName:"h3"},"AudioTimedMetadataReceived")),(0,l.kt)("p",null,"Fired when the current track receives metadata encoded in - dynamic metadata tied to a time. Events may be emitted over time."),(0,l.kt)("p",null,"Received data will be ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/metadata"},(0,l.kt)("inlineCode",{parentName:"a"},"AudioMetadataReceivedEvent")),"."),(0,l.kt)("h3",{id:"audiochaptermetadatareceived-ios-only"},(0,l.kt)("inlineCode",{parentName:"h3"},"AudioChapterMetadataReceived")," (iOS only)"),(0,l.kt)("p",null,"Fired when the current track receives metadata encoded in - chapter overview data. Usually received at start."),(0,l.kt)("p",null,"Received data will be ",(0,l.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/metadata"},(0,l.kt)("inlineCode",{parentName:"a"},"AudioMetadataReceivedEvent")),"."))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6ae9250f.80039c12.js b/assets/js/6ae9250f.dada5e94.js similarity index 58% rename from assets/js/6ae9250f.80039c12.js rename to assets/js/6ae9250f.dada5e94.js index d258ef9d9..20c49ac04 100644 --- a/assets/js/6ae9250f.80039c12.js +++ b/assets/js/6ae9250f.dada5e94.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[9020],{3905:function(e,t,n){n.d(t,{Zo:function(){return c},kt:function(){return m}});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),s=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return a.createElement(u.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,u=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,f=d["".concat(u,".").concat(m)]||d[m]||p[m]||l;return n?a.createElement(f,i(i({ref:t},c),{},{components:n})):a.createElement(f,i({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=d;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var s=2;s child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})),b=null!=d?d:v.map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes}})),y=(0,i.lx)(b,(function(e,t){return e.value===t.value}));if(y.length>0)throw new Error('Docusaurus error: Duplicate values "'+y.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.');var h=null===p?p:null!=(t=null!=p?p:null==(n=v.find((function(e){return e.props.default})))?void 0:n.props.value)?t:null==(l=v[0])?void 0:l.props.value;if(null!==h&&!b.some((function(e){return e.value===h})))throw new Error('Docusaurus error: The has a defaultValue "'+h+'" but none of its children has the corresponding value. Available values are: '+b.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");var k=(0,i.UB)(),g=k.tabGroupChoices,w=k.setTabGroupChoices,N=(0,r.useState)(h),T=N[0],x=N[1],O=[],E=(0,i.o5)().blockElementScrollPositionUntilNextRender;if(null!=m){var S=g[m];null!=S&&S!==T&&b.some((function(e){return e.value===S}))&&x(S)}var P=function(e){var t=e.currentTarget,n=O.indexOf(t),a=b[n].value;a!==T&&(E(t),x(a),null!=m&&w(m,a))},j=function(e){var t,n=null;switch(e.key){case"ArrowRight":var a=O.indexOf(e.currentTarget)+1;n=O[a]||O[0];break;case"ArrowLeft":var r=O.indexOf(e.currentTarget)-1;n=O[r]||O[O.length-1]}null==(t=n)||t.focus()};return r.createElement("div",{className:"tabs-container"},r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":c},f)},b.map((function(e){var t=e.value,n=e.label,l=e.attributes;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:T===t?0:-1,"aria-selected":T===t,key:t,ref:function(e){return O.push(e)},onKeyDown:j,onFocus:P,onClick:P},l,{className:(0,o.Z)("tabs__item",u,null==l?void 0:l.className,{"tabs__item--active":T===t})}),null!=n?n:t)}))),s?(0,r.cloneElement)(v.filter((function(e){return e.props.value===T}))[0],{className:"margin-vert--md"}):r.createElement("div",{className:"margin-vert--md"},v.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==T})}))))}function c(e){var t=(0,l.Z)();return r.createElement(s,(0,a.Z)({key:String(t)},e))}},523:function(e,t,n){n.r(t),n.d(t,{assets:function(){return d},contentTitle:function(){return c},default:function(){return v},frontMatter:function(){return s},metadata:function(){return p},toc:function(){return m}});var a=n(7462),r=n(3366),l=(n(7294),n(3905)),i=n(9877),o=n(8215),u=["components"],s={sidebar_position:1},c="Installation",p={unversionedId:"basics/installation",id:"version-4.0/basics/installation",title:"Installation",description:"Stable",source:"@site/versioned_docs/version-4.0/basics/installation.mdx",sourceDirName:"basics",slug:"/basics/installation",permalink:"/docs/basics/installation",editUrl:"https://github.com/doublesymmetry/react-native-track-player/tree/main/docs/versioned_docs/version-4.0/basics/installation.mdx",tags:[],version:"4.0",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"app",previous:{title:"Intro",permalink:"/docs/intro"},next:{title:"Getting Started",permalink:"/docs/basics/getting-started"}},d={},m=[{value:"Stable",id:"stable",level:2},{value:"Unstable / Nightly",id:"unstable--nightly",level:2},{value:"iOS Setup",id:"ios-setup",level:2},{value:"Enable Swift Modules",id:"enable-swift-modules",level:3},{value:"Pod Install",id:"pod-install",level:3},{value:"Expo",id:"expo",level:2}],f={toc:m};function v(e){var t=e.components,n=(0,r.Z)(e,u);return(0,l.kt)("wrapper",(0,a.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"installation"},"Installation"),(0,l.kt)("h2",{id:"stable"},"Stable"),(0,l.kt)(i.Z,{groupId:"pkg",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"npm",label:"NPM",default:!0,mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"npm install --save react-native-track-player\n"))),(0,l.kt)(o.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"yarn add react-native-track-player\n")))),(0,l.kt)("h2",{id:"unstable--nightly"},"Unstable / Nightly"),(0,l.kt)("p",null,"If for some reason you require an update that has not yet been officially\nreleased you can install the ",(0,l.kt)("inlineCode",{parentName:"p"},"nightly")," version which is an automatic release of\n",(0,l.kt)("inlineCode",{parentName:"p"},"main")," published to npm every 24hrs."),(0,l.kt)(i.Z,{groupId:"pkg",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"npm",label:"NPM",default:!0,mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"npm install --save react-native-track-player@nightly\n"))),(0,l.kt)(o.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"yarn add react-native-track-player@nightly\n")))),(0,l.kt)("h2",{id:"ios-setup"},"iOS Setup"),(0,l.kt)("p",null,"iOS requires a few extra steps that are ",(0,l.kt)("em",{parentName:"p"},"not")," required for Android/Windows."),(0,l.kt)("h3",{id:"enable-swift-modules"},"Enable Swift Modules"),(0,l.kt)("p",null,"Because the iOS module uses Swift, if the user is using a standard react-native application they'll need to add support for Swift in the project. This can be easily by adding a swift file to the Xcode project -- could be called ",(0,l.kt)("inlineCode",{parentName:"p"},"dummy.swift")," and saying yes when prompted if you'd like to generate a bridging header."),(0,l.kt)("p",null,(0,l.kt)("img",{parentName:"p",src:"https://i.imgur.com/CBqBcWs.png",alt:"Importing Swift"})),(0,l.kt)("h3",{id:"pod-install"},"Pod Install"),(0,l.kt)("p",null,"You'll need to run a ",(0,l.kt)("inlineCode",{parentName:"p"},"pod install")," in order to install the native iOS dependencies"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"cd ios && pod install\n")),(0,l.kt)("h2",{id:"expo"},"Expo"),(0,l.kt)("p",null,"You can now use React Native Track Player with Expo. "),(0,l.kt)("p",null,"Please be aware that while many people are using React Native Track Player with Expo successfully, the current maintainers of this project do not use Expo and their ability to resolve issues involving Expo is limited."),(0,l.kt)("p",null,"To get started, create a ",(0,l.kt)("a",{parentName:"p",href:"https://docs.expo.dev/clients/getting-started/"},"custom development client")," for your Expo app and then install React Native Track Player."),(0,l.kt)("p",null,"Here is the configuration required for audio playback in background:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://docs.expo.dev/versions/latest/sdk/audio/#playing-or-recording-audio-in-background"},"iOS: Enable audio playback in background via your app.json")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"/docs/basics/background-mode/#android"},"Android: Stop playback when the app is closed"))))}v.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[9020],{3905:function(e,t,n){n.d(t,{Zo:function(){return c},kt:function(){return m}});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),s=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return a.createElement(u.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,u=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,f=d["".concat(u,".").concat(m)]||d[m]||p[m]||l;return n?a.createElement(f,i(i({ref:t},c),{},{components:n})):a.createElement(f,i({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=d;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var s=2;s child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})),b=null!=d?d:v.map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes}})),y=(0,i.lx)(b,(function(e,t){return e.value===t.value}));if(y.length>0)throw new Error('Docusaurus error: Duplicate values "'+y.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.');var h=null===p?p:null!=(t=null!=p?p:null==(n=v.find((function(e){return e.props.default})))?void 0:n.props.value)?t:null==(l=v[0])?void 0:l.props.value;if(null!==h&&!b.some((function(e){return e.value===h})))throw new Error('Docusaurus error: The has a defaultValue "'+h+'" but none of its children has the corresponding value. Available values are: '+b.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");var k=(0,i.UB)(),g=k.tabGroupChoices,w=k.setTabGroupChoices,N=(0,r.useState)(h),T=N[0],x=N[1],O=[],E=(0,i.o5)().blockElementScrollPositionUntilNextRender;if(null!=m){var S=g[m];null!=S&&S!==T&&b.some((function(e){return e.value===S}))&&x(S)}var P=function(e){var t=e.currentTarget,n=O.indexOf(t),a=b[n].value;a!==T&&(E(t),x(a),null!=m&&w(m,a))},j=function(e){var t,n=null;switch(e.key){case"ArrowRight":var a=O.indexOf(e.currentTarget)+1;n=O[a]||O[0];break;case"ArrowLeft":var r=O.indexOf(e.currentTarget)-1;n=O[r]||O[O.length-1]}null==(t=n)||t.focus()};return r.createElement("div",{className:"tabs-container"},r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":c},f)},b.map((function(e){var t=e.value,n=e.label,l=e.attributes;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:T===t?0:-1,"aria-selected":T===t,key:t,ref:function(e){return O.push(e)},onKeyDown:j,onFocus:P,onClick:P},l,{className:(0,o.Z)("tabs__item",u,null==l?void 0:l.className,{"tabs__item--active":T===t})}),null!=n?n:t)}))),s?(0,r.cloneElement)(v.filter((function(e){return e.props.value===T}))[0],{className:"margin-vert--md"}):r.createElement("div",{className:"margin-vert--md"},v.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==T})}))))}function c(e){var t=(0,l.Z)();return r.createElement(s,(0,a.Z)({key:String(t)},e))}},523:function(e,t,n){n.r(t),n.d(t,{assets:function(){return d},contentTitle:function(){return c},default:function(){return v},frontMatter:function(){return s},metadata:function(){return p},toc:function(){return m}});var a=n(7462),r=n(3366),l=(n(7294),n(3905)),i=n(9877),o=n(8215),u=["components"],s={sidebar_position:1},c="Installation",p={unversionedId:"basics/installation",id:"version-4.0/basics/installation",title:"Installation",description:"Stable",source:"@site/versioned_docs/version-4.0/basics/installation.mdx",sourceDirName:"basics",slug:"/basics/installation",permalink:"/docs/4.0/basics/installation",editUrl:"https://github.com/doublesymmetry/react-native-track-player/tree/main/docs/versioned_docs/version-4.0/basics/installation.mdx",tags:[],version:"4.0",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"app",previous:{title:"Intro",permalink:"/docs/4.0/intro"},next:{title:"Getting Started",permalink:"/docs/4.0/basics/getting-started"}},d={},m=[{value:"Stable",id:"stable",level:2},{value:"Unstable / Nightly",id:"unstable--nightly",level:2},{value:"iOS Setup",id:"ios-setup",level:2},{value:"Enable Swift Modules",id:"enable-swift-modules",level:3},{value:"Pod Install",id:"pod-install",level:3},{value:"Expo",id:"expo",level:2}],f={toc:m};function v(e){var t=e.components,n=(0,r.Z)(e,u);return(0,l.kt)("wrapper",(0,a.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"installation"},"Installation"),(0,l.kt)("h2",{id:"stable"},"Stable"),(0,l.kt)(i.Z,{groupId:"pkg",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"npm",label:"NPM",default:!0,mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"npm install --save react-native-track-player\n"))),(0,l.kt)(o.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"yarn add react-native-track-player\n")))),(0,l.kt)("h2",{id:"unstable--nightly"},"Unstable / Nightly"),(0,l.kt)("p",null,"If for some reason you require an update that has not yet been officially\nreleased you can install the ",(0,l.kt)("inlineCode",{parentName:"p"},"nightly")," version which is an automatic release of\n",(0,l.kt)("inlineCode",{parentName:"p"},"main")," published to npm every 24hrs."),(0,l.kt)(i.Z,{groupId:"pkg",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"npm",label:"NPM",default:!0,mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"npm install --save react-native-track-player@nightly\n"))),(0,l.kt)(o.Z,{value:"yarn",label:"Yarn",mdxType:"TabItem"},(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"yarn add react-native-track-player@nightly\n")))),(0,l.kt)("h2",{id:"ios-setup"},"iOS Setup"),(0,l.kt)("p",null,"iOS requires a few extra steps that are ",(0,l.kt)("em",{parentName:"p"},"not")," required for Android/Windows."),(0,l.kt)("h3",{id:"enable-swift-modules"},"Enable Swift Modules"),(0,l.kt)("p",null,"Because the iOS module uses Swift, if the user is using a standard react-native application they'll need to add support for Swift in the project. This can be easily by adding a swift file to the Xcode project -- could be called ",(0,l.kt)("inlineCode",{parentName:"p"},"dummy.swift")," and saying yes when prompted if you'd like to generate a bridging header."),(0,l.kt)("p",null,(0,l.kt)("img",{parentName:"p",src:"https://i.imgur.com/CBqBcWs.png",alt:"Importing Swift"})),(0,l.kt)("h3",{id:"pod-install"},"Pod Install"),(0,l.kt)("p",null,"You'll need to run a ",(0,l.kt)("inlineCode",{parentName:"p"},"pod install")," in order to install the native iOS dependencies"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-sh"},"cd ios && pod install\n")),(0,l.kt)("h2",{id:"expo"},"Expo"),(0,l.kt)("p",null,"You can now use React Native Track Player with Expo. "),(0,l.kt)("p",null,"Please be aware that while many people are using React Native Track Player with Expo successfully, the current maintainers of this project do not use Expo and their ability to resolve issues involving Expo is limited."),(0,l.kt)("p",null,"To get started, create a ",(0,l.kt)("a",{parentName:"p",href:"https://docs.expo.dev/clients/getting-started/"},"custom development client")," for your Expo app and then install React Native Track Player."),(0,l.kt)("p",null,"Here is the configuration required for audio playback in background:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://docs.expo.dev/versions/latest/sdk/audio/#playing-or-recording-audio-in-background"},"iOS: Enable audio playback in background via your app.json")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"/docs/4.0/basics/background-mode/#android"},"Android: Stop playback when the app is closed"))))}v.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1d3e5a90.b7a57e4a.js b/assets/js/6b498f1a.d43a989b.js similarity index 96% rename from assets/js/1d3e5a90.b7a57e4a.js rename to assets/js/6b498f1a.d43a989b.js index dce5f7c93..a734a6c18 100644 --- a/assets/js/1d3e5a90.b7a57e4a.js +++ b/assets/js/6b498f1a.d43a989b.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[8111],{3905:function(t,e,n){n.d(e,{Zo:function(){return u},kt:function(){return c}});var a=n(7294);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function i(t){for(var e=1;e=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var p=a.createContext({}),d=function(t){var e=a.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):i(i({},e),t)),n},u=function(t){var e=d(t.components);return a.createElement(p.Provider,{value:e},t.children)},s={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},m=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,o=t.originalType,p=t.parentName,u=l(t,["components","mdxType","originalType","parentName"]),m=d(n),c=r,k=m["".concat(p,".").concat(c)]||m[c]||s[c]||o;return n?a.createElement(k,i(i({ref:e},u),{},{components:n})):a.createElement(k,i({ref:e},u))}));function c(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var o=n.length,i=new Array(o);i[0]=m;var l={};for(var p in e)hasOwnProperty.call(e,p)&&(l[p]=e[p]);l.originalType=t,l.mdxType="string"==typeof t?t:r,i[1]=l;for(var d=2;d=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var p=a.createContext({}),d=function(t){var e=a.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):i(i({},e),t)),n},u=function(t){var e=d(t.components);return a.createElement(p.Provider,{value:e},t.children)},s={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},m=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,o=t.originalType,p=t.parentName,u=l(t,["components","mdxType","originalType","parentName"]),m=d(n),c=r,k=m["".concat(p,".").concat(c)]||m[c]||s[c]||o;return n?a.createElement(k,i(i({ref:e},u),{},{components:n})):a.createElement(k,i({ref:e},u))}));function c(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var o=n.length,i=new Array(o);i[0]=m;var l={};for(var p in e)hasOwnProperty.call(e,p)&&(l[p]=e[p]);l.originalType=t,l.mdxType="string"==typeof t?t:r,i[1]=l;for(var d=2;d=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var d=n.createContext({}),m=function(t){var e=n.useContext(d),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},k=function(t){var e=m(t.components);return n.createElement(d.Provider,{value:e},t.children)},N={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},c=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,d=t.parentName,k=p(t,["components","mdxType","originalType","parentName"]),c=m(a),o=r,g=c["".concat(d,".").concat(o)]||c[o]||N[o]||l;return a?n.createElement(g,i(i({ref:e},k),{},{components:a})):n.createElement(g,i({ref:e},k))}));function o(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=c;var p={};for(var d in e)hasOwnProperty.call(e,d)&&(p[d]=e[d]);p.originalType=t,p.mdxType="string"==typeof t?t:r,i[1]=p;for(var m=2;m=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var l=o.createContext({}),c=function(e){var t=o.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},d=function(e){var t=c(e.components);return o.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var r=e.components,n=e.mdxType,i=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=c(r),f=n,m=u["".concat(l,".").concat(f)]||u[f]||p[f]||i;return r?o.createElement(m,a(a({ref:t},d),{},{components:r})):o.createElement(m,a({ref:t},d))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=r.length,a=new Array(i);a[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:n,a[1]=s;for(var c=2;clibrary not found for -lswiftCoreAudio for architecture x86_64",id:"ios-enable-swift-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64",level:2},{value:"Android: CIRCULAR REFERENCE:com.android.tools.r8.ApiLevelException: Default interface methods are only supported starting with Android N (--min-api 24)",id:"android-circular-referencecomandroidtoolsr8apilevelexception-default-interface-methods-are-only-supported-starting-with-android-n---min-api-24",level:2},{value:"Android: com.facebook.react.common.JavascriptException: No task registered for key TrackPlayer",id:"android-comfacebookreactcommonjavascriptexception-no-task-registered-for-key-trackplayer",level:2},{value:"Android: Error: Attribute XXX from [androidx.core:core:XXX] is also present at [com.android.support:support-compat:XXX]",id:"android-error-attribute-xxx-from-androidxcorecorexxx-is-also-present-at-comandroidsupportsupport-compatxxx",level:2},{value:"Android: Cleartext HTTP traffic not permitted",id:"android-cleartext-http-traffic-not-permitted",level:2},{value:"Web: Issues with HLS Streams",id:"web-issues-with-hls-streams",level:2}],u={toc:p};function f(e){var t=e.components,r=(0,n.Z)(e,a);return(0,i.kt)("wrapper",(0,o.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"troubleshooting"},"Troubleshooting"),(0,i.kt)("h2",{id:"ios-enable-swift-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64"},"iOS: (Enable Swift) ",(0,i.kt)("inlineCode",{parentName:"h2"},"library not found for -lswiftCoreAudio for architecture x86_64")),(0,i.kt)("p",null,"Because the iOS module uses Swift, if the user is using a standard react-native application they'll need to add support for Swift in the project. This can easily be done by adding a swift file to the Xcode project -- could be called ",(0,i.kt)("inlineCode",{parentName:"p"},"dummy.swift")," and saying yes when prompted if you'd like to generate a bridging header."),(0,i.kt)("p",null,(0,i.kt)("img",{parentName:"p",src:"https://i.imgur.com/CBqBcWs.png",alt:"Importing Swift"})),(0,i.kt)("h2",{id:"android-circular-referencecomandroidtoolsr8apilevelexception-default-interface-methods-are-only-supported-starting-with-android-n---min-api-24"},"Android: ",(0,i.kt)("inlineCode",{parentName:"h2"},"CIRCULAR REFERENCE:com.android.tools.r8.ApiLevelException: Default interface methods are only supported starting with Android N (--min-api 24)")),(0,i.kt)("p",null,"Since version 1.0.0, we began using a few Java 8 features in the project to reduce the code size."),(0,i.kt)("p",null,"To fix the issue, add the following options to your ",(0,i.kt)("inlineCode",{parentName:"p"},"android/app/build.gradle")," file:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-diff"},"android {\n ...\n+ compileOptions {\n+ sourceCompatibility JavaVersion.VERSION_1_8\n+ targetCompatibility JavaVersion.VERSION_1_8\n+ }\n ...\n}\n")),(0,i.kt)("h2",{id:"android-comfacebookreactcommonjavascriptexception-no-task-registered-for-key-trackplayer"},"Android: ",(0,i.kt)("inlineCode",{parentName:"h2"},"com.facebook.react.common.JavascriptException: No task registered for key TrackPlayer")),(0,i.kt)("p",null,"The playback service requires a headless task to be registered. You have to register it with ",(0,i.kt)("inlineCode",{parentName:"p"},"registerPlaybackService"),"."),(0,i.kt)("h2",{id:"android-error-attribute-xxx-from-androidxcorecorexxx-is-also-present-at-comandroidsupportsupport-compatxxx"},"Android: ",(0,i.kt)("inlineCode",{parentName:"h2"},"Error: Attribute XXX from [androidx.core:core:XXX] is also present at [com.android.support:support-compat:XXX]")),(0,i.kt)("p",null,"This error occurs when you're mixing both AndroidX and the Support Library in the same project."),(0,i.kt)("p",null,"You have to either upgrade everything to AndroidX or downgrade everything to the support library."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"For react-native-track-player, the last version to run the support library is ",(0,i.kt)("strong",{parentName:"li"},"1.1.4")," and the first version to run AndroidX is ",(0,i.kt)("strong",{parentName:"li"},"1.2.0"),"."),(0,i.kt)("li",{parentName:"ul"},"For react-native, the last version to run the support library is ",(0,i.kt)("strong",{parentName:"li"},"0.59")," and the first version to run AndroidX is ",(0,i.kt)("strong",{parentName:"li"},"0.60"),".")),(0,i.kt)("p",null,"You can also use ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/mikehardy/jetifier#usage-for-source-files"},"jetifier")," to convert all of the native code to use only one of them."),(0,i.kt)("h2",{id:"android-cleartext-http-traffic-not-permitted"},"Android: Cleartext HTTP traffic not permitted"),(0,i.kt)("p",null,"Since API 28, Android disables traffic without TLS. To fix the issue you have to use ",(0,i.kt)("inlineCode",{parentName:"p"},"https")," or ",(0,i.kt)("a",{parentName:"p",href:"https://stackoverflow.com/a/50834600"},"enable clear text traffic"),"."),(0,i.kt)("h2",{id:"web-issues-with-hls-streams"},"Web: Issues with HLS Streams"),(0,i.kt)("p",null,"If your HLS content uses MPEG2-TS, you may need to enable transmuxing. The\nonly browsers capable of playing TS natively are Edge and Chromecast. You will\nget a ",(0,i.kt)("inlineCode",{parentName:"p"},"CONTENT_UNSUPPORTED_BY_BROWSER")," error on other browsers due to their lack\nof TS support."),(0,i.kt)("p",null,"You can enable transmuxing by including ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/mux.js"},"mux.js"),"\nv5.6.3+ in your application. Once installed mux.js will be auto-detected and\nwill be used use to transmux TS content into MP4 on-the-fly, so that the content\ncan be played by the browser."),(0,i.kt)("p",null,"NOTE: there are some limitations to ",(0,i.kt)("inlineCode",{parentName:"p"},"mux.js")," so not all possible content codec's\nare supported."))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7239a3d4.762b0e36.js b/assets/js/7239a3d4.762b0e36.js new file mode 100644 index 000000000..a836cf27b --- /dev/null +++ b/assets/js/7239a3d4.762b0e36.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[6773],{3905:function(e,t,a){a.d(t,{Zo:function(){return k},kt:function(){return s}});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),o=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},k=function(e){var t=o(e.components);return n.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,k=d(e,["components","mdxType","originalType","parentName"]),u=o(a),s=r,c=u["".concat(p,".").concat(s)]||u[s]||m[s]||l;return a?n.createElement(c,i(i({ref:t},k),{},{components:a})):n.createElement(c,i({ref:t},k))}));function s(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=u;var d={};for(var p in t)hasOwnProperty.call(t,p)&&(d[p]=t[p]);d.originalType=e,d.mdxType="string"==typeof e?e:r,i[1]=d;for(var o=2;oPlaybackState",id:"playbackstate",level:3},{value:"PlaybackActiveTrackChanged",id:"playbackactivetrackchanged",level:3},{value:"PlaybackQueueEnded",id:"playbackqueueended",level:3},{value:"PlaybackMetadataReceived",id:"playbackmetadatareceived",level:3},{value:"PlaybackProgressUpdated",id:"playbackprogressupdated",level:3},{value:"PlaybackError",id:"playbackerror",level:3},{value:"PlaybackPlayWhenReadyChanged",id:"playbackplaywhenreadychanged",level:3},{value:"\u26a0\ufe0fPlaybackTrackChanged",id:"\ufe0fplaybacktrackchanged",level:3},{value:"Media Controls",id:"media-controls",level:2},{value:"RemotePlay",id:"remoteplay",level:3},{value:"RemotePlayId",id:"remoteplayid",level:3},{value:"RemotePlaySearch",id:"remoteplaysearch",level:3},{value:"RemotePause",id:"remotepause",level:3},{value:"RemoteStop",id:"remotestop",level:3},{value:"RemoteSkip",id:"remoteskip",level:3},{value:"RemoteNext",id:"remotenext",level:3},{value:"RemotePrevious",id:"remoteprevious",level:3},{value:"RemoteSeek",id:"remoteseek",level:3},{value:"RemoteSetRating",id:"remotesetrating",level:3},{value:"RemoteJumpForward",id:"remotejumpforward",level:3},{value:"RemoteJumpBackward",id:"remotejumpbackward",level:3},{value:"RemoteLike (iOS only)",id:"remotelike-ios-only",level:3},{value:"RemoteDislike (iOS only)",id:"remotedislike-ios-only",level:3},{value:"RemoteBookmark (iOS only)",id:"remotebookmark-ios-only",level:3},{value:"RemoteDuck",id:"remoteduck",level:3},{value:"Metadata",id:"metadata",level:2},{value:"AudioCommonMetadataReceived",id:"audiocommonmetadatareceived",level:3},{value:"AudioTimedMetadataReceived",id:"audiotimedmetadatareceived",level:3},{value:"AudioChapterMetadataReceived (iOS only)",id:"audiochaptermetadatareceived-ios-only",level:3}],u={toc:m};function s(e){var t=e.components,a=(0,r.Z)(e,i);return(0,l.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"events"},"Events"),(0,l.kt)("p",null,"All event types are made available through the named export ",(0,l.kt)("inlineCode",{parentName:"p"},"Event"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"},"import { Event } from 'react-native-track-player';\n")),(0,l.kt)("h2",{id:"player"},"Player"),(0,l.kt)("h3",{id:"playbackstate"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackState")),(0,l.kt)("p",null,"Fired when the state of the player changes."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"state"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("a",{parentName:"td",href:"/docs/api/constants/state"},"State")),(0,l.kt)("td",{parentName:"tr",align:null},"The new state")))),(0,l.kt)("h3",{id:"playbackactivetrackchanged"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackActiveTrackChanged")),(0,l.kt)("p",null,"The new event also includes the full track objects for the newly active and last tracks."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"lastIndex"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")),(0,l.kt)("td",{parentName:"tr",align:null},"The index of previously active track.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"lastTrack"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"Track")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")),(0,l.kt)("td",{parentName:"tr",align:null},"The previously active track or ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")," when there wasn't a previously active track.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"lastPosition"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The position of the previously active track in seconds.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"index"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")),(0,l.kt)("td",{parentName:"tr",align:null},"The newly active track index or ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")," if there is no longer an active track.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"track"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"Track")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")),(0,l.kt)("td",{parentName:"tr",align:null},"The newly active track or ",(0,l.kt)("inlineCode",{parentName:"td"},"undefined")," if there is no longer an active track.")))),(0,l.kt)("h3",{id:"playbackqueueended"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackQueueEnded")),(0,l.kt)("p",null,"Fired when the queue reaches the end."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"track"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The previous track index. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"position"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The previous track position in seconds")))),(0,l.kt)("h3",{id:"playbackmetadatareceived"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackMetadataReceived")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated:")," Please use ",(0,l.kt)("inlineCode",{parentName:"p"},"AudioChapterMetadataReceived"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"AudioTimedMetadataReceived"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"AudioCommonMetadataReceived"),"."),(0,l.kt)("p",null,"Fired when the current track receives metadata encoded in. (e.g. ID3 tags, Icy Metadata, Vorbis Comments or QuickTime metadata)."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"source"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The metadata source (",(0,l.kt)("inlineCode",{parentName:"td"},"id3"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"icy"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"icy-headers"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"vorbis-comment"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"quicktime"),")")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"title"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track title. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"url"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track url. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"artist"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track artist. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"album"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track album. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"date"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track date. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"genre"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track genre. Might be null")))),(0,l.kt)("h3",{id:"playbackprogressupdated"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackProgressUpdated")),(0,l.kt)("p",null,"\u26a0\ufe0f Note: This event is only emitted if you specify a non-zero ",(0,l.kt)("inlineCode",{parentName:"p"},"progressUpdateEventInterval")," value in your player options."),(0,l.kt)("p",null,"Fired at the ",(0,l.kt)("inlineCode",{parentName:"p"},"progressUpdateEventInterval")," if the player is playing ",(0,l.kt)("em",{parentName:"p"},"and")," if a ",(0,l.kt)("inlineCode",{parentName:"p"},"progressUpdateEventInterval")," has been specified."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"position"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"See ",(0,l.kt)("a",{parentName:"td",href:"/docs/api/functions/player#getProgress"},(0,l.kt)("inlineCode",{parentName:"a"},"getProgress")))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"duration"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"See ",(0,l.kt)("a",{parentName:"td",href:"/docs/api/functions/player#getProgress"},(0,l.kt)("inlineCode",{parentName:"a"},"getProgress")))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"buffered"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"See ",(0,l.kt)("a",{parentName:"td",href:"/docs/api/functions/player#getProgress"},(0,l.kt)("inlineCode",{parentName:"a"},"getProgress")))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"track"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The current index in the queue of the track.")))),(0,l.kt)("h3",{id:"playbackerror"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackError")),(0,l.kt)("p",null,"Fired when an error occurs."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"code"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The error code")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"message"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The error message")))),(0,l.kt)("h3",{id:"playbackplaywhenreadychanged"},(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackPlayWhenReadyChanged")),(0,l.kt)("p",null,"Fired when the ",(0,l.kt)("inlineCode",{parentName:"p"},"playWhenReady")," property is changed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"playWhenReady"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"boolean")),(0,l.kt)("td",{parentName:"tr",align:null},"The current value of ",(0,l.kt)("inlineCode",{parentName:"td"},"playWhenReady"))))),(0,l.kt)("h3",{id:"\ufe0fplaybacktrackchanged"},"\u26a0\ufe0f",(0,l.kt)("inlineCode",{parentName:"h3"},"PlaybackTrackChanged")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated:")," Please use ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaybackActiveTrackChanged"),"."),(0,l.kt)("p",null,"Fired when a track is changed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"track"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The previous track index. Might be null")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"position"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The previous track position in seconds")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"nextTrack"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The next track index. Might be null")))),(0,l.kt)("hr",null),(0,l.kt)("h2",{id:"media-controls"},"Media Controls"),(0,l.kt)("h3",{id:"remoteplay"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePlay")),(0,l.kt)("p",null,"Fired when the user presses the play button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.Play"))," is allowed."),(0,l.kt)("h3",{id:"remoteplayid"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePlayId")),(0,l.kt)("p",null,"Fired when the user selects a track from an external device. Required for Android Auto support. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.PlayFromId"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"id"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track id")))),(0,l.kt)("h3",{id:"remoteplaysearch"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePlaySearch")),(0,l.kt)("p",null,"Fired when the user searches for a track (usually voice search). Required for Android Auto support. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.PlayFromSearch"))," is allowed."),(0,l.kt)("p",null,"Every parameter except ",(0,l.kt)("inlineCode",{parentName:"p"},"query")," is optional and may not be provided.\nIn the case where ",(0,l.kt)("inlineCode",{parentName:"p"},"query")," is empty, feel free to select any track to play."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"query"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The search query")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"focus"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The focus of the search. One of ",(0,l.kt)("inlineCode",{parentName:"td"},"artist"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"album"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"playlist")," or ",(0,l.kt)("inlineCode",{parentName:"td"},"genre"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"title"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track title")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"artist"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track artist")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"album"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track album")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"genre"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track genre")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"playlist"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"string")),(0,l.kt)("td",{parentName:"tr",align:null},"The track playlist")))),(0,l.kt)("h3",{id:"remotepause"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePause")),(0,l.kt)("p",null,"Fired when the user presses the pause button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.Pause"))," is allowed or if there's a change in outputs (e.g.: headphone disconnected)."),(0,l.kt)("h3",{id:"remotestop"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteStop")),(0,l.kt)("p",null,"Fired when the user presses the stop button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.Stop"))," is allowed."),(0,l.kt)("h3",{id:"remoteskip"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteSkip")),(0,l.kt)("p",null,"Fired when the user skips to a track in the queue. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.Skip"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"index"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The track index")))),(0,l.kt)("h3",{id:"remotenext"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteNext")),(0,l.kt)("p",null,"Fired when the user presses the next track button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.SkipToNext"))," is allowed."),(0,l.kt)("h3",{id:"remoteprevious"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemotePrevious")),(0,l.kt)("p",null,"Fired when the user presses the previous track button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.SkipToPrevious"))," is allowed."),(0,l.kt)("h3",{id:"remoteseek"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteSeek")),(0,l.kt)("p",null,"Fired when the user changes the position of the timeline. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.SeekTo"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"position"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The position to seek to in seconds")))),(0,l.kt)("h3",{id:"remotesetrating"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteSetRating")),(0,l.kt)("p",null,"Fired when the user changes the rating for the track. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.SetRating"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"rating"),(0,l.kt)("td",{parentName:"tr",align:null},"Depends on the ",(0,l.kt)("a",{parentName:"td",href:"/docs/api/constants/rating"},"Rating Type")),(0,l.kt)("td",{parentName:"tr",align:null},"The rating that was set")))),(0,l.kt)("h3",{id:"remotejumpforward"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteJumpForward")),(0,l.kt)("p",null,"Fired when the user presses the jump forward button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.JumpForward"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"interval"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The number of seconds to jump forward. It's usually the ",(0,l.kt)("inlineCode",{parentName:"td"},"forwardJumpInterval")," set in the options.")))),(0,l.kt)("h3",{id:"remotejumpbackward"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteJumpBackward")),(0,l.kt)("p",null,"Fired when the user presses the jump backward button. Only fired if the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/constants/capability"},(0,l.kt)("inlineCode",{parentName:"a"},"Capability.JumpBackward"))," is allowed."),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"interval"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"number")),(0,l.kt)("td",{parentName:"tr",align:null},"The number of seconds to jump backward. It's usually the ",(0,l.kt)("inlineCode",{parentName:"td"},"backwardJumpInterval")," set in the options.")))),(0,l.kt)("h3",{id:"remotelike-ios-only"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteLike")," (iOS only)"),(0,l.kt)("p",null,"Fired when the user presses the like button in the now playing center. Only fired if the ",(0,l.kt)("inlineCode",{parentName:"p"},"likeOptions")," is set in ",(0,l.kt)("inlineCode",{parentName:"p"},"updateOptions"),"."),(0,l.kt)("h3",{id:"remotedislike-ios-only"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteDislike")," (iOS only)"),(0,l.kt)("p",null,"Fired when the user presses the dislike button in the now playing center. Only fired if the ",(0,l.kt)("inlineCode",{parentName:"p"},"dislikeOptions")," is set in ",(0,l.kt)("inlineCode",{parentName:"p"},"updateOptions"),"."),(0,l.kt)("h3",{id:"remotebookmark-ios-only"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteBookmark")," (iOS only)"),(0,l.kt)("p",null,"Fired when the user presses the bookmark button in the now playing center. Only fired if the ",(0,l.kt)("inlineCode",{parentName:"p"},"bookmarkOptions")," is set in ",(0,l.kt)("inlineCode",{parentName:"p"},"updateOptions"),"."),(0,l.kt)("h3",{id:"remoteduck"},(0,l.kt)("inlineCode",{parentName:"h3"},"RemoteDuck")),(0,l.kt)("p",null,"Fired when the audio is interrupted. For example when a phone call arrives,\na clock or calender sounds, or another app starts playing audio."),(0,l.kt)("p",null,"We recommend to set ",(0,l.kt)("inlineCode",{parentName:"p"},"autoHandleInterruptions: true")," in\n",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.setupPlayer"),". This way toggling playback is handled automatically."),(0,l.kt)("p",null,"By default ",(0,l.kt)("inlineCode",{parentName:"p"},"autoHandleInterruptions")," is set to ",(0,l.kt)("inlineCode",{parentName:"p"},"false")," (default) in\n",(0,l.kt)("inlineCode",{parentName:"p"},"TrackPlayer.setupPlayer"),", which means your app is expected to respond to this\nevent in the following situations:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"When the event is triggered with ",(0,l.kt)("inlineCode",{parentName:"li"},"paused")," set to ",(0,l.kt)("inlineCode",{parentName:"li"},"true"),", on Android playback\nshould be paused. When ",(0,l.kt)("inlineCode",{parentName:"li"},"permanent")," is also set to ",(0,l.kt)("inlineCode",{parentName:"li"},"true"),", on Android the\nplayer should stop playback."),(0,l.kt)("li",{parentName:"ul"},"When the event is triggered and ",(0,l.kt)("inlineCode",{parentName:"li"},"paused")," is set to ",(0,l.kt)("inlineCode",{parentName:"li"},"false"),", the player may\nresume playback.")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"Param"),(0,l.kt)("th",{parentName:"tr",align:null},"Type"),(0,l.kt)("th",{parentName:"tr",align:null},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"paused"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"boolean")),(0,l.kt)("td",{parentName:"tr",align:null},"On Android when ",(0,l.kt)("inlineCode",{parentName:"td"},"true")," the player should pause playback, when ",(0,l.kt)("inlineCode",{parentName:"td"},"false")," the player may resume playback. On iOS when ",(0,l.kt)("inlineCode",{parentName:"td"},"true")," the playback was paused and when ",(0,l.kt)("inlineCode",{parentName:"td"},"false")," the player may resume playback.")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"permanent"),(0,l.kt)("td",{parentName:"tr",align:null},(0,l.kt)("inlineCode",{parentName:"td"},"boolean")),(0,l.kt)("td",{parentName:"tr",align:null},"Whether the interruption is permanent. On Android the player should stop playback.")))),(0,l.kt)("h2",{id:"metadata"},"Metadata"),(0,l.kt)("h3",{id:"audiocommonmetadatareceived"},(0,l.kt)("inlineCode",{parentName:"h3"},"AudioCommonMetadataReceived")),(0,l.kt)("p",null,"Fired when the current track receives metadata encoded in - static metadata not tied to a time. Usually received at start."),(0,l.kt)("p",null,"Received data will be ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/metadata"},(0,l.kt)("inlineCode",{parentName:"a"},"AudioCommonMetadataReceivedEvent")),"."),(0,l.kt)("h3",{id:"audiotimedmetadatareceived"},(0,l.kt)("inlineCode",{parentName:"h3"},"AudioTimedMetadataReceived")),(0,l.kt)("p",null,"Fired when the current track receives metadata encoded in - dynamic metadata tied to a time. Events may be emitted over time."),(0,l.kt)("p",null,"Received data will be ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/metadata"},(0,l.kt)("inlineCode",{parentName:"a"},"AudioMetadataReceivedEvent")),"."),(0,l.kt)("h3",{id:"audiochaptermetadatareceived-ios-only"},(0,l.kt)("inlineCode",{parentName:"h3"},"AudioChapterMetadataReceived")," (iOS only)"),(0,l.kt)("p",null,"Fired when the current track receives metadata encoded in - chapter overview data. Usually received at start."),(0,l.kt)("p",null,"Received data will be ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/objects/metadata"},(0,l.kt)("inlineCode",{parentName:"a"},"AudioMetadataReceivedEvent")),"."))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7ef8eea2.6c8b6450.js b/assets/js/74dd9064.2b341219.js similarity index 93% rename from assets/js/7ef8eea2.6c8b6450.js rename to assets/js/74dd9064.2b341219.js index 49a5c3140..acb139067 100644 --- a/assets/js/7ef8eea2.6c8b6450.js +++ b/assets/js/74dd9064.2b341219.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[2664],{3905:function(t,e,n){n.d(e,{Zo:function(){return c},kt:function(){return m}});var a=n(7294);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function o(t){for(var e=1;e=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var p=a.createContext({}),s=function(t){var e=a.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):o(o({},e),t)),n},c=function(t){var e=s(t.components);return a.createElement(p.Provider,{value:e},t.children)},u={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},d=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,i=t.originalType,p=t.parentName,c=l(t,["components","mdxType","originalType","parentName"]),d=s(n),m=r,g=d["".concat(p,".").concat(m)]||d[m]||u[m]||i;return n?a.createElement(g,o(o({ref:e},c),{},{components:n})):a.createElement(g,o({ref:e},c))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var p in e)hasOwnProperty.call(e,p)&&(l[p]=e[p]);l.originalType=t,l.mdxType="string"==typeof t?t:r,o[1]=l;for(var s=2;s=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var p=a.createContext({}),s=function(t){var e=a.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):o(o({},e),t)),n},c=function(t){var e=s(t.components);return a.createElement(p.Provider,{value:e},t.children)},u={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},d=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,i=t.originalType,p=t.parentName,c=l(t,["components","mdxType","originalType","parentName"]),d=s(n),m=r,g=d["".concat(p,".").concat(m)]||d[m]||u[m]||i;return n?a.createElement(g,o(o({ref:e},c),{},{components:n})):a.createElement(g,o({ref:e},c))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var p in e)hasOwnProperty.call(e,p)&&(l[p]=e[p]);l.originalType=t,l.mdxType="string"==typeof t?t:r,o[1]=l;for(var s=2;s=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=c(a),k=r,y=d["".concat(s,".").concat(k)]||d[k]||u[k]||o;return a?n.createElement(y,i(i({ref:t},p),{},{components:a})):n.createElement(y,i({ref:t},p))}));function k(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c require('./service'));\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'// service.js\nmodule.exports = async function() {\n // This service needs to be registered for the module to work\n // but it will be used later in the "Receiving Events" section\n}\n')),(0,o.kt)("p",null,"Then, you need to set up the player. This usually takes less than a second:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"import TrackPlayer from 'react-native-track-player';\n\nawait TrackPlayer.setupPlayer()\n// The player is ready to be used\n")),(0,o.kt)("p",null,"Make sure the setup method has completed before interacting with any other functions in ",(0,o.kt)("inlineCode",{parentName:"p"},"TrackPlayer")," in order to avoid instability."),(0,o.kt)("h2",{id:"controlling-the-player"},"Controlling the Player"),(0,o.kt)("h3",{id:"adding-tracks-to-the-playback-queue"},"Adding Tracks to the Playback Queue"),(0,o.kt)("p",null,"You can add a track to the player using a url or by requiring a file in the app\nbundle or on the file system."),(0,o.kt)("p",null,"First of all, you need to create a ",(0,o.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/track"},"track object"),", which\nis a plain javascript object with a number of properties describing the track.\nThen add the track to the queue:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"var track1 = {\n url: 'http://example.com/avaritia.mp3', // Load media from the network\n title: 'Avaritia',\n artist: 'deadmau5',\n album: 'while(1<2)',\n genre: 'Progressive House, Electro House',\n date: '2014-05-20T07:00:00+00:00', // RFC 3339\n artwork: 'http://example.com/cover.png', // Load artwork from the network\n duration: 402 // Duration in seconds\n};\n\nconst track2 = {\n url: require('./coelacanth.ogg'), // Load media from the app bundle\n title: 'Coelacanth I',\n artist: 'deadmau5',\n artwork: require('./cover.jpg'), // Load artwork from the app bundle\n duration: 166\n};\n\nconst track3 = {\n url: 'file:///storage/sdcard0/Downloads/artwork.png', // Load media from the file system\n title: 'Ice Age',\n artist: 'deadmau5',\n // Load artwork from the file system:\n artwork: 'file:///storage/sdcard0/Downloads/cover.png',\n duration: 411\n};\n\n// You can then [add](https://rntp.dev/docs/api/functions/queue#addtracks-insertbeforeindex) the items to the queue\nawait TrackPlayer.add([track1, track2, track3]);\n")),(0,o.kt)("h3",{id:"player-information"},"Player Information"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"\nimport TrackPlayer, { State } from 'react-native-track-player';\n\nconst state = await TrackPlayer.getState();\nif (state === State.Playing) {\n console.log('The player is playing');\n};\n\nlet trackIndex = await TrackPlayer.getCurrentTrack();\nlet trackObject = await TrackPlayer.getTrack(trackIndex);\nconsole.log(`Title: ${trackObject.title}`);\n\nconst position = await TrackPlayer.getPosition();\nconst duration = await TrackPlayer.getDuration();\nconsole.log(`${duration - position} seconds left.`);\n")),(0,o.kt)("h3",{id:"changing-playback-state"},"Changing Playback State"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"TrackPlayer.play();\nTrackPlayer.pause();\nTrackPlayer.reset();\n\n// Seek to 12.5 seconds:\nTrackPlayer.seekTo(12.5);\n\n// Set volume to 50%:\nTrackPlayer.setVolume(0.5);\n")),(0,o.kt)("h3",{id:"controlling-the-queue"},"Controlling the Queue"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"// Skip to a specific track index:\nawait TrackPlayer.skip(trackIndex);\n\n// Skip to the next track in the queue:\nawait TrackPlayer.skipToNext();\n\n// Skip to the previous track in the queue:\nawait TrackPlayer.skipToPrevious();\n\n// Remove two tracks from the queue:\nawait TrackPlayer.remove([trackIndex1, trackIndex2]);\n\n// Retrieve the track objects in the queue:\nconst tracks = await TrackPlayer.getQueue();\nconsole.log(`First title: ${tracks[0].title}`);\n")),(0,o.kt)("h4",{id:"playback-events"},"Playback Events"),(0,o.kt)("p",null,"You can subscribe to ",(0,o.kt)("a",{parentName:"p",href:"/docs/4.0/api/events#player"},"player events"),", which describe the\nchanging nature of the playback state. For example, subscribe to the\n",(0,o.kt)("inlineCode",{parentName:"p"},"Event.PlaybackTrackChanged")," event to be notified when the track has changed or\nsubscribe to the ",(0,o.kt)("inlineCode",{parentName:"p"},"Event.PlaybackState")," event to be notified when the player\nbuffers, plays, pauses and stops."),(0,o.kt)("h4",{id:"example"},"Example"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import TrackPlayer, { Event } from 'react-native-track-player';\n\nconst PlayerInfo = () => {\n const [trackTitle, setTrackTitle] = useState();\n\n // do initial setup, set initial trackTitle..\n\n useTrackPlayerEvents([Event.PlaybackTrackChanged], async event => {\n if (event.type === Event.PlaybackTrackChanged && event.nextTrack != null) {\n const track = await TrackPlayer.getTrack(event.nextTrack);\n const {title} = track || {};\n setTrackTitle(title);\n }\n });\n\n return (\n {trackTitle}\n );\n}\n")),(0,o.kt)("h2",{id:"progress-updates"},"Progress Updates"),(0,o.kt)("p",null,"Music apps often need an automated way to show the progress of a playing track.\nFor this purpose, we created ",(0,o.kt)("a",{parentName:"p",href:"/docs/4.0/api/hooks"},"the hook: ",(0,o.kt)("inlineCode",{parentName:"a"},"useProgress"))," which\nupdates itself automatically."),(0,o.kt)("h4",{id:"example-1"},"Example"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import TrackPlayer, { useProgress } from 'react-native-track-player';\n\nconst MyPlayerBar = () => {\n const progress = useProgress();\n\n return (\n // Note: formatTime and ProgressBar are just examples:\n \n {formatTime(progress.position)}\n \n \n );\n\n}\n")),(0,o.kt)("h2",{id:"track-player-options"},"Track Player Options"),(0,o.kt)("p",null,"Track Player can be configured using a number of options. Some of these options\npertain to the media controls available in the lockscreen / notification and how\nthey behave, others describe the availability of capabilities needed for\nplatform specific functionalities like Android Auto."),(0,o.kt)("p",null,"You can change options multiple times. You do not need to specify all the\noptions, just the ones you want to change."),(0,o.kt)("p",null,"For more information about the properties you can set, ",(0,o.kt)("a",{parentName:"p",href:"/docs/4.0/api/functions/player#updateoptionsoptions"},"check the\ndocumentation"),"."),(0,o.kt)("h4",{id:"example-2"},"Example"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"import TrackPlayer, { Capability } from 'react-native-track-player';\n\nTrackPlayer.updateOptions({\n // Media controls capabilities\n capabilities: [\n Capability.Play,\n Capability.Pause,\n Capability.SkipToNext,\n Capability.SkipToPrevious,\n Capability.Stop,\n ],\n\n // Capabilities that will show up when the notification is in the compact form on Android\n compactCapabilities: [Capability.Play, Capability.Pause],\n\n // Icons for the notification on Android (if you don't like the default ones)\n playIcon: require('./play-icon.png'),\n pauseIcon: require('./pause-icon.png'),\n stopIcon: require('./stop-icon.png'),\n previousIcon: require('./previous-icon.png'),\n nextIcon: require('./next-icon.png'),\n icon: require('./notification-icon.png')\n});\n")))}k.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7b37f89c.525f0239.js b/assets/js/7b37f89c.525f0239.js new file mode 100644 index 000000000..c5342f3fe --- /dev/null +++ b/assets/js/7b37f89c.525f0239.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[2927],{3905:function(t,e,a){a.d(e,{Zo:function(){return m},kt:function(){return c}});var n=a(7294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function i(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var o=n.createContext({}),p=function(t){var e=n.useContext(o),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},m=function(t){var e=p(t.components);return n.createElement(o.Provider,{value:e},t.children)},u={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},k=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,o=t.parentName,m=d(t,["components","mdxType","originalType","parentName"]),k=p(a),c=r,g=k["".concat(o,".").concat(c)]||k[c]||u[c]||l;return a?n.createElement(g,i(i({ref:e},m),{},{components:a})):n.createElement(g,i({ref:e},m))}));function c(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=k;var d={};for(var o in e)hasOwnProperty.call(e,o)&&(d[o]=e[o]);d.originalType=t,d.mdxType="string"==typeof t?t:r,i[1]=d;for(var p=2;p=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var p=a.createContext({}),d=function(t){var e=a.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):o(o({},e),t)),n},c=function(t){var e=d(t.components);return a.createElement(p.Provider,{value:e},t.children)},s={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},u=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,i=t.originalType,p=t.parentName,c=l(t,["components","mdxType","originalType","parentName"]),u=d(n),m=r,y=u["".concat(p,".").concat(m)]||u[m]||s[m]||i;return n?a.createElement(y,o(o({ref:e},c),{},{components:n})):a.createElement(y,o({ref:e},c))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var i=n.length,o=new Array(i);o[0]=u;var l={};for(var p in e)hasOwnProperty.call(e,p)&&(l[p]=e[p]);l.originalType=t,l.mdxType="string"==typeof t?t:r,o[1]=l;for(var d=2;d=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=t.createContext({}),c=function(e){var r=t.useContext(p),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},l=function(e){var r=c(e.components);return t.createElement(p.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},d=t.forwardRef((function(e,r){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=c(n),g=o,h=d["".concat(p,".").concat(g)]||d[g]||u[g]||a;return n?t.createElement(h,s(s({ref:r},l),{},{components:n})):t.createElement(h,s({ref:r},l))}));function g(e,r){var n=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=d;var i={};for(var p in r)hasOwnProperty.call(r,p)&&(i[p]=r[p]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var c=2;c App);")," in your ",(0,a.kt)("inlineCode",{parentName:"p"},"index.js")," file)\n",(0,a.kt)("strong",{parentName:"p"},"WILL NOT EXECUTE"),"."),(0,a.kt)("p",null,"In a nutshell, if you do this, you're progress ",(0,a.kt)("strong",{parentName:"p"},"will not")," update when the user\nis playing back in Remote contexts and therefore your app will seem buggy."),(0,a.kt)("h2",{id:"recommended-approach"},"Recommended Approach"),(0,a.kt)("p",null,"The correct way to handle this is to track progress in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/basics/playback-service"},"Playback Service"),", based on the\n",(0,a.kt)("inlineCode",{parentName:"p"},"Event.PlaybackProgressUpdated")," event. These events fire all the time, including\nwhen your app is playing back remotely."))}g.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[6235],{3905:function(e,r,n){n.d(r,{Zo:function(){return l},kt:function(){return g}});var t=n(7294);function o(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=t.createContext({}),c=function(e){var r=t.useContext(p),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},l=function(e){var r=c(e.components);return t.createElement(p.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},d=t.forwardRef((function(e,r){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=c(n),g=o,h=d["".concat(p,".").concat(g)]||d[g]||u[g]||a;return n?t.createElement(h,s(s({ref:r},l),{},{components:n})):t.createElement(h,s({ref:r},l))}));function g(e,r){var n=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=d;var i={};for(var p in r)hasOwnProperty.call(r,p)&&(i[p]=r[p]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var c=2;c App);")," in your ",(0,a.kt)("inlineCode",{parentName:"p"},"index.js")," file)\n",(0,a.kt)("strong",{parentName:"p"},"WILL NOT EXECUTE"),"."),(0,a.kt)("p",null,"In a nutshell, if you do this, you're progress ",(0,a.kt)("strong",{parentName:"p"},"will not")," update when the user\nis playing back in Remote contexts and therefore your app will seem buggy."),(0,a.kt)("h2",{id:"recommended-approach"},"Recommended Approach"),(0,a.kt)("p",null,"The correct way to handle this is to track progress in the\n",(0,a.kt)("a",{parentName:"p",href:"/docs/basics/playback-service"},"Playback Service"),", based on the\n",(0,a.kt)("inlineCode",{parentName:"p"},"Event.PlaybackProgressUpdated")," event. These events fire all the time, including\nwhen your app is playing back remotely."))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7ef8eea2.d2c31e1a.js b/assets/js/7ef8eea2.d2c31e1a.js new file mode 100644 index 000000000..33fff1ac6 --- /dev/null +++ b/assets/js/7ef8eea2.d2c31e1a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[2664],{3905:function(t,e,n){n.d(e,{Zo:function(){return c},kt:function(){return m}});var a=n(7294);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function o(t){for(var e=1;e=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var p=a.createContext({}),s=function(t){var e=a.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):o(o({},e),t)),n},c=function(t){var e=s(t.components);return a.createElement(p.Provider,{value:e},t.children)},u={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},d=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,i=t.originalType,p=t.parentName,c=l(t,["components","mdxType","originalType","parentName"]),d=s(n),m=r,g=d["".concat(p,".").concat(m)]||d[m]||u[m]||i;return n?a.createElement(g,o(o({ref:e},c),{},{components:n})):a.createElement(g,o({ref:e},c))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var p in e)hasOwnProperty.call(e,p)&&(l[p]=e[p]);l.originalType=t,l.mdxType="string"==typeof t?t:r,o[1]=l;for(var s=2;s=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},l=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),l=s(n),f=o,m=l["".concat(p,".").concat(f)]||l[f]||d[f]||a;return n?r.createElement(m,i(i({ref:t},u),{},{components:n})):r.createElement(m,i({ref:t},u))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=l;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var s=2;s=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),d=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},k=function(e){var t=d(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,k=o(e,["components","mdxType","originalType","parentName"]),m=d(a),c=r,s=m["".concat(p,".").concat(c)]||m[c]||u[c]||i;return a?n.createElement(s,l(l({ref:t},k),{},{components:a})):n.createElement(s,l({ref:t},k))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=m;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,l[1]=o;for(var d=2;dadd(tracks, insertBeforeIndex)",id:"addtracks-insertbeforeindex",level:2},{value:"remove(tracks)",id:"removetracks",level:2},{value:"setQueue(tracks)",id:"setqueuetracks",level:2},{value:"load(track)",id:"loadtrack",level:2},{value:"skip(index, initialPosition)",id:"skipindex-initialposition",level:2},{value:"skipToNext(initialPosition)",id:"skiptonextinitialposition",level:2},{value:"skipToPrevious(initialPosition)",id:"skiptopreviousinitialposition",level:2},{value:"move(fromIndex, toIndex)",id:"movefromindex-toindex",level:2},{value:"reset()",id:"reset",level:2},{value:"getTrack(index)",id:"gettrackindex",level:2},{value:"getActiveTrack()",id:"getactivetrack",level:2},{value:"getActiveTrackIndex()",id:"getactivetrackindex",level:2},{value:"getQueue()",id:"getqueue",level:2},{value:"removeUpcomingTracks()",id:"removeupcomingtracks",level:2},{value:"updateMetadataForTrack(index, metadata)",id:"updatemetadatafortrackindex-metadata",level:2},{value:"setRepeatMode(mode)",id:"setrepeatmodemode",level:2},{value:"getRepeatMode()",id:"getrepeatmode",level:2},{value:"\u26a0\ufe0f getCurrentTrack()",id:"\ufe0f-getcurrenttrack",level:2}],m={toc:u};function c(e){var t=e.components,a=(0,r.Z)(e,l);return(0,i.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"queue"},"Queue"),(0,i.kt)("h2",{id:"addtracks-insertbeforeindex"},(0,i.kt)("inlineCode",{parentName:"h2"},"add(tracks, insertBeforeIndex)")),(0,i.kt)("p",null,"Adds one or more tracks to the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")," - The promise resolves with the first\nadded track index. If no tracks were added it returns ",(0,i.kt)("inlineCode",{parentName:"p"},"void"),"."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"tracks"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"Track \\| Track[]")),(0,i.kt)("td",{parentName:"tr",align:null},"The ",(0,i.kt)("a",{parentName:"td",href:"/docs/4.0/api/objects/track"},"Track")," objects that will be added")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"insertBeforeIndex"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The index of the track that will be located immediately after the inserted tracks. Set it to ",(0,i.kt)("inlineCode",{parentName:"td"},"null")," to add it at the end of the queue")))),(0,i.kt)("h2",{id:"removetracks"},(0,i.kt)("inlineCode",{parentName:"h2"},"remove(tracks)")),(0,i.kt)("p",null,"Removes one or more tracks from the queue. If the current track is removed, the next track will activated. If the current track was the last track in the queue, the first track will be activated."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"tracks"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"Track \\| Track[]")),(0,i.kt)("td",{parentName:"tr",align:null},"The ",(0,i.kt)("a",{parentName:"td",href:"/docs/4.0/api/objects/track"},"Track")," objects that will be removed")))),(0,i.kt)("h2",{id:"setqueuetracks"},(0,i.kt)("inlineCode",{parentName:"h2"},"setQueue(tracks)")),(0,i.kt)("p",null,"Clears the current queue and adds the supplied tracks to the now empty queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"tracks"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"Track[]")),(0,i.kt)("td",{parentName:"tr",align:null},"An array of ",(0,i.kt)("a",{parentName:"td",href:"/docs/4.0/api/objects/track"},"Track")," to replace the current queue with.")))),(0,i.kt)("h2",{id:"loadtrack"},(0,i.kt)("inlineCode",{parentName:"h2"},"load(track)")),(0,i.kt)("p",null,"Replaces the current track with the supplied track or creates a track when the queue is empty."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"track"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"Track")),(0,i.kt)("td",{parentName:"tr",align:null},"The ",(0,i.kt)("a",{parentName:"td",href:"/docs/4.0/api/objects/track"},"Track")," object that will be loaded")))),(0,i.kt)("h2",{id:"skipindex-initialposition"},(0,i.kt)("inlineCode",{parentName:"h2"},"skip(index, initialPosition)")),(0,i.kt)("p",null,"Skips to a track in the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"index"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The track index")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"initialPosition"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("strong",{parentName:"td"},"Optional.")," Sets the initial playback for the track you're skipping to.")))),(0,i.kt)("h2",{id:"skiptonextinitialposition"},(0,i.kt)("inlineCode",{parentName:"h2"},"skipToNext(initialPosition)")),(0,i.kt)("p",null,"Skips to the next track in the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"initialPosition"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("strong",{parentName:"td"},"Optional.")," Sets the initial playback for the track you're skipping to.")))),(0,i.kt)("h2",{id:"skiptopreviousinitialposition"},(0,i.kt)("inlineCode",{parentName:"h2"},"skipToPrevious(initialPosition)")),(0,i.kt)("p",null,"Skips to the previous track in the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"initialPosition"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("strong",{parentName:"td"},"Optional.")," Sets the initial playback for the track you're skipping to.")))),(0,i.kt)("h2",{id:"movefromindex-toindex"},(0,i.kt)("inlineCode",{parentName:"h2"},"move(fromIndex, toIndex)")),(0,i.kt)("p",null,"Moves a track from the specified index to another."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"fromIndex"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The index of the track you'd like to move.")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"toIndex"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The position you'd like to move the track to.")))),(0,i.kt)("h2",{id:"reset"},(0,i.kt)("inlineCode",{parentName:"h2"},"reset()")),(0,i.kt)("p",null,"Resets the player stopping the current track and clearing the queue."),(0,i.kt)("h2",{id:"gettrackindex"},(0,i.kt)("inlineCode",{parentName:"h2"},"getTrack(index)")),(0,i.kt)("p",null,"Gets a track object from the queue."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,i.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/track"},"Track"),(0,i.kt)("inlineCode",{parentName:"p"},">")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"index"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The track index")))),(0,i.kt)("h2",{id:"getactivetrack"},(0,i.kt)("inlineCode",{parentName:"h2"},"getActiveTrack()")),(0,i.kt)("p",null,"Gets the active track object."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,i.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/track"},"Track"),(0,i.kt)("inlineCode",{parentName:"p"}," | undefined>")),(0,i.kt)("h2",{id:"getactivetrackindex"},(0,i.kt)("inlineCode",{parentName:"h2"},"getActiveTrackIndex()")),(0,i.kt)("p",null,"Gets the index of the current track, or ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined")," if no track loaded"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("h2",{id:"getqueue"},(0,i.kt)("inlineCode",{parentName:"h2"},"getQueue()")),(0,i.kt)("p",null,"Gets the whole queue"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise<"),(0,i.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/track"},"Track[]"),(0,i.kt)("inlineCode",{parentName:"p"},">")),(0,i.kt)("h2",{id:"removeupcomingtracks"},(0,i.kt)("inlineCode",{parentName:"h2"},"removeUpcomingTracks()")),(0,i.kt)("p",null,"Clears any upcoming tracks from the queue."),(0,i.kt)("h2",{id:"updatemetadatafortrackindex-metadata"},(0,i.kt)("inlineCode",{parentName:"h2"},"updateMetadataForTrack(index, metadata)")),(0,i.kt)("p",null,"Updates the metadata of a track in the queue.\nIf the current track is updated, the notification and the Now Playing Center will be updated accordingly."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"index"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"The track index")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"metadata"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"object")),(0,i.kt)("td",{parentName:"tr",align:null},"A subset of the ",(0,i.kt)("a",{parentName:"td",href:"/docs/4.0/api/objects/track"},"Track Object")," with only the ",(0,i.kt)("inlineCode",{parentName:"td"},"artwork"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"title"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"artist"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"album"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"description"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"genre"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"date"),", ",(0,i.kt)("inlineCode",{parentName:"td"},"rating")," and ",(0,i.kt)("inlineCode",{parentName:"td"},"duration")," properties.")))),(0,i.kt)("h2",{id:"setrepeatmodemode"},(0,i.kt)("inlineCode",{parentName:"h2"},"setRepeatMode(mode)")),(0,i.kt)("p",null,"Sets the repeat mode."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"mode"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("a",{parentName:"td",href:"/docs/4.0/api/constants/repeat-mode"},"Repeat Mode")),(0,i.kt)("td",{parentName:"tr",align:null},"The repeat mode")))),(0,i.kt)("h2",{id:"getrepeatmode"},(0,i.kt)("inlineCode",{parentName:"h2"},"getRepeatMode()")),(0,i.kt)("p",null,"Gets the repeat mode."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("a",{parentName:"p",href:"/docs/4.0/api/constants/repeat-mode"},"Repeat Mode")),(0,i.kt)("h2",{id:"\ufe0f-getcurrenttrack"},"\u26a0\ufe0f ",(0,i.kt)("inlineCode",{parentName:"h2"},"getCurrentTrack()")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"\u26a0\ufe0f Deprecated:")," To get the active track index use\n",(0,i.kt)("a",{parentName:"p",href:"#getactivetrackindex"},(0,i.kt)("inlineCode",{parentName:"a"},"getActiveTrackIndex()"))," instead or use\n",(0,i.kt)("a",{parentName:"p",href:"#getactivetrack"},(0,i.kt)("inlineCode",{parentName:"a"},"getActiveTrack()"))," to get the active track object."),(0,i.kt)("p",null,"Gets the index of the current track, or null if no track loaded"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8c06d75f.22aaeb00.js b/assets/js/8c06d75f.22aaeb00.js new file mode 100644 index 000000000..ec5785dbf --- /dev/null +++ b/assets/js/8c06d75f.22aaeb00.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[7700],{3905:function(e,t,r){r.d(t,{Zo:function(){return c},kt:function(){return d}});var n=r(7294);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,c=a(e,["components","mdxType","originalType","parentName"]),m=p(r),d=i,f=m["".concat(l,".").concat(d)]||m[d]||u[d]||o;return r?n.createElement(f,s(s({ref:t},c),{},{components:r})):n.createElement(f,s({ref:t},c))}));function d(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=r.length,s=new Array(o);s[0]=m;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a.mdxType="string"==typeof e?e:i,s[1]=a;for(var p=2;p=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=p(r),g=o,m=d["".concat(l,".").concat(g)]||d[g]||c[g]||s;return r?n.createElement(m,a(a({ref:t},u),{},{components:r})):n.createElement(m,a({ref:t},u))}));function g(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,a=new Array(s);a[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,a[1]=i;for(var p=2;p;\n setProgress: (id: string, progress: number) => void;\n};\n\nexport const useProgressStateStore = create(\n (set: SetState) => ({\n map: {},\n setProgress: (id: string, progress: number) => set((state) => {\n state.map[id] = progress;\n }),\n })\n);\n")),(0,s.kt)("p",null,"Let's also set up a little helper hook to make it easier to read progress (we'll\nuse this later on):"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-ts"},"// src/hooks/useTrackProgress.ts\nimport { useCallback } from 'react';\nimport { useProgressStateStore } from '../store';\n\nexport const useTrackProgress = (id: string | number): number => {\n return useProgressStateStore(useCallback(state => {\n return state.map[id.toString()] || 0;\n }, [id]));\n};\n")),(0,s.kt)("h4",{id:"2-listen-to-progress-updates"},"2. Listen To Progress Updates"),(0,s.kt)("p",null,"Next we need to set up a listener for progress updates in our\n",(0,s.kt)("a",{parentName:"p",href:"/docs/basics/playback-service"},"playback service")," and update our zustand store:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-ts"},"// src/services/PlaybackService.ts\nimport TrackPlayer, { Event } from 'react-native-track-player';\nimport { useProgressStateStore } from '../store';\n\n// create a local reference for the `setProgress` function\nconst setProgress = useProgressStateStore.getState().setProgress;\n\nexport const PlaybackService = async function() {\n TrackPlayer.addEventListener(Event.PlaybackProgressUpdated, async ({ position, track }) => {\n // get the track to fetch your unique ID property (if applicable)\n const track = await TrackPlayer.getTrack(track);\n // write progress to the zustand store\n setProgress(track.id, position);\n });\n};\n")),(0,s.kt)("p",null,"\u26a0\ufe0f make sure you've configured your ",(0,s.kt)("inlineCode",{parentName:"p"},"progressUpdateEventInterval"),"\nin the ",(0,s.kt)("inlineCode",{parentName:"p"},"TrackPlayer.updateOptions")," call."),(0,s.kt)("h4",{id:"3-reactively-update-progress"},"3. Reactively Update Progress"),(0,s.kt)("p",null,"Finally, we just need to read from the store whenever we display our track list\nitem:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-ts"},"// src/components/TrackListItem.tsx\nimport type { Track } from 'react-native-track-player';\nimport { useTrackProgress } from '../hooks/useTrackProgress';\n\nexport interface TrackListItemProps {}\n\nexport const TrackListItem: React.FC = (track: Track) => {\n const progress = useTrackProgress(track.id);\n return (\n Progress: {progress}\n );\n};\n")),(0,s.kt)("p",null,"\ud83c\udf8a voil\xe0"))}g.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[4807],{3905:function(e,t,r){r.d(t,{Zo:function(){return u},kt:function(){return g}});var n=r(7294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=p(r),g=o,m=d["".concat(l,".").concat(g)]||d[g]||c[g]||s;return r?n.createElement(m,a(a({ref:t},u),{},{components:r})):n.createElement(m,a({ref:t},u))}));function g(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,a=new Array(s);a[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,a[1]=i;for(var p=2;p;\n setProgress: (id: string, progress: number) => void;\n};\n\nexport const useProgressStateStore = create(\n (set: SetState) => ({\n map: {},\n setProgress: (id: string, progress: number) => set((state) => {\n state.map[id] = progress;\n }),\n })\n);\n")),(0,s.kt)("p",null,"Let's also set up a little helper hook to make it easier to read progress (we'll\nuse this later on):"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-ts"},"// src/hooks/useTrackProgress.ts\nimport { useCallback } from 'react';\nimport { useProgressStateStore } from '../store';\n\nexport const useTrackProgress = (id: string | number): number => {\n return useProgressStateStore(useCallback(state => {\n return state.map[id.toString()] || 0;\n }, [id]));\n};\n")),(0,s.kt)("h4",{id:"2-listen-to-progress-updates"},"2. Listen To Progress Updates"),(0,s.kt)("p",null,"Next we need to set up a listener for progress updates in our\n",(0,s.kt)("a",{parentName:"p",href:"/docs/basics/playback-service"},"playback service")," and update our zustand store:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-ts"},"// src/services/PlaybackService.ts\nimport TrackPlayer, { Event } from 'react-native-track-player';\nimport { useProgressStateStore } from '../store';\n\n// create a local reference for the `setProgress` function\nconst setProgress = useProgressStateStore.getState().setProgress;\n\nexport const PlaybackService = async function() {\n TrackPlayer.addEventListener(Event.PlaybackProgressUpdated, async ({ position, track }) => {\n // get the track to fetch your unique ID property (if applicable)\n const track = await TrackPlayer.getTrack(track);\n // write progress to the zustand store\n setProgress(track.id, position);\n });\n};\n")),(0,s.kt)("p",null,"\u26a0\ufe0f make sure you've configured your ",(0,s.kt)("inlineCode",{parentName:"p"},"progressUpdateEventInterval"),"\nin the ",(0,s.kt)("inlineCode",{parentName:"p"},"TrackPlayer.updateOptions")," call."),(0,s.kt)("h4",{id:"3-reactively-update-progress"},"3. Reactively Update Progress"),(0,s.kt)("p",null,"Finally, we just need to read from the store whenever we display our track list\nitem:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-ts"},"// src/components/TrackListItem.tsx\nimport type { Track } from 'react-native-track-player';\nimport { useTrackProgress } from '../hooks/useTrackProgress';\n\nexport interface TrackListItemProps {}\n\nexport const TrackListItem: React.FC = (track: Track) => {\n const progress = useTrackProgress(track.id);\n return (\n Progress: {progress}\n );\n};\n")),(0,s.kt)("p",null,"\ud83c\udf8a voil\xe0"))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8e2f3fc5.a3ca6cca.js b/assets/js/8e2f3fc5.a3ca6cca.js new file mode 100644 index 000000000..043967374 --- /dev/null +++ b/assets/js/8e2f3fc5.a3ca6cca.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[284],{3905:function(e,t,r){r.d(t,{Zo:function(){return p},kt:function(){return d}});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),m=c(r),d=a,f=m["".concat(s,".").concat(d)]||m[d]||u[d]||o;return r?n.createElement(f,i(i({ref:t},p),{},{components:r})):n.createElement(f,i({ref:t},p))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var c=2;c {\n await TrackPlayer.setupPlayer({});\n\n await TrackPlayer.add({\n url: require('track.mp3'),\n title: 'Track Title',\n artist: 'Track Artist',\n artwork: require('track.png')\n });\n\n TrackPlayer.setRepeatMode(RepeatMode.Queue);\n};\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/78ef4445.50c7a7ad.js b/assets/js/94f117cd.796ac9f6.js similarity index 97% rename from assets/js/78ef4445.50c7a7ad.js rename to assets/js/94f117cd.796ac9f6.js index 3cc8dc37c..aa1a9d612 100644 --- a/assets/js/78ef4445.50c7a7ad.js +++ b/assets/js/94f117cd.796ac9f6.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[7946],{3905:function(e,t,a){a.d(t,{Zo:function(){return p},kt:function(){return k}});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=c(a),k=r,y=d["".concat(s,".").concat(k)]||d[k]||u[k]||o;return a?n.createElement(y,i(i({ref:t},p),{},{components:a})):n.createElement(y,i({ref:t},p))}));function k(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c require('./service'));\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'// service.js\nmodule.exports = async function() {\n // This service needs to be registered for the module to work\n // but it will be used later in the "Receiving Events" section\n}\n')),(0,o.kt)("p",null,"Then, you need to set up the player. This usually takes less than a second:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"import TrackPlayer from 'react-native-track-player';\n\nawait TrackPlayer.setupPlayer()\n// The player is ready to be used\n")),(0,o.kt)("p",null,"Make sure the setup method has completed before interacting with any other functions in ",(0,o.kt)("inlineCode",{parentName:"p"},"TrackPlayer")," in order to avoid instability."),(0,o.kt)("h2",{id:"controlling-the-player"},"Controlling the Player"),(0,o.kt)("h3",{id:"adding-tracks-to-the-playback-queue"},"Adding Tracks to the Playback Queue"),(0,o.kt)("p",null,"You can add a track to the player using a url or by requiring a file in the app\nbundle or on the file system."),(0,o.kt)("p",null,"First of all, you need to create a ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/objects/track"},"track object"),", which\nis a plain javascript object with a number of properties describing the track.\nThen add the track to the queue:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"var track1 = {\n url: 'http://example.com/avaritia.mp3', // Load media from the network\n title: 'Avaritia',\n artist: 'deadmau5',\n album: 'while(1<2)',\n genre: 'Progressive House, Electro House',\n date: '2014-05-20T07:00:00+00:00', // RFC 3339\n artwork: 'http://example.com/cover.png', // Load artwork from the network\n duration: 402 // Duration in seconds\n};\n\nconst track2 = {\n url: require('./coelacanth.ogg'), // Load media from the app bundle\n title: 'Coelacanth I',\n artist: 'deadmau5',\n artwork: require('./cover.jpg'), // Load artwork from the app bundle\n duration: 166\n};\n\nconst track3 = {\n url: 'file:///storage/sdcard0/Downloads/artwork.png', // Load media from the file system\n title: 'Ice Age',\n artist: 'deadmau5',\n // Load artwork from the file system:\n artwork: 'file:///storage/sdcard0/Downloads/cover.png',\n duration: 411\n};\n\n// You can then [add](https://rntp.dev/docs/api/functions/queue#addtracks-insertbeforeindex) the items to the queue\nawait TrackPlayer.add([track1, track2, track3]);\n")),(0,o.kt)("h3",{id:"player-information"},"Player Information"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"\nimport TrackPlayer, { State } from 'react-native-track-player';\n\nconst state = await TrackPlayer.getState();\nif (state === State.Playing) {\n console.log('The player is playing');\n};\n\nlet trackIndex = await TrackPlayer.getCurrentTrack();\nlet trackObject = await TrackPlayer.getTrack(trackIndex);\nconsole.log(`Title: ${trackObject.title}`);\n\nconst position = await TrackPlayer.getPosition();\nconst duration = await TrackPlayer.getDuration();\nconsole.log(`${duration - position} seconds left.`);\n")),(0,o.kt)("h3",{id:"changing-playback-state"},"Changing Playback State"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"TrackPlayer.play();\nTrackPlayer.pause();\nTrackPlayer.reset();\n\n// Seek to 12.5 seconds:\nTrackPlayer.seekTo(12.5);\n\n// Set volume to 50%:\nTrackPlayer.setVolume(0.5);\n")),(0,o.kt)("h3",{id:"controlling-the-queue"},"Controlling the Queue"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"// Skip to a specific track index:\nawait TrackPlayer.skip(trackIndex);\n\n// Skip to the next track in the queue:\nawait TrackPlayer.skipToNext();\n\n// Skip to the previous track in the queue:\nawait TrackPlayer.skipToPrevious();\n\n// Remove two tracks from the queue:\nawait TrackPlayer.remove([trackIndex1, trackIndex2]);\n\n// Retrieve the track objects in the queue:\nconst tracks = await TrackPlayer.getQueue();\nconsole.log(`First title: ${tracks[0].title}`);\n")),(0,o.kt)("h4",{id:"playback-events"},"Playback Events"),(0,o.kt)("p",null,"You can subscribe to ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/events#player"},"player events"),", which describe the\nchanging nature of the playback state. For example, subscribe to the\n",(0,o.kt)("inlineCode",{parentName:"p"},"Event.PlaybackTrackChanged")," event to be notified when the track has changed or\nsubscribe to the ",(0,o.kt)("inlineCode",{parentName:"p"},"Event.PlaybackState")," event to be notified when the player\nbuffers, plays, pauses and stops."),(0,o.kt)("h4",{id:"example"},"Example"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import TrackPlayer, { Event } from 'react-native-track-player';\n\nconst PlayerInfo = () => {\n const [trackTitle, setTrackTitle] = useState();\n\n // do initial setup, set initial trackTitle..\n\n useTrackPlayerEvents([Event.PlaybackTrackChanged], async event => {\n if (event.type === Event.PlaybackTrackChanged && event.nextTrack != null) {\n const track = await TrackPlayer.getTrack(event.nextTrack);\n const {title} = track || {};\n setTrackTitle(title);\n }\n });\n\n return (\n {trackTitle}\n );\n}\n")),(0,o.kt)("h2",{id:"progress-updates"},"Progress Updates"),(0,o.kt)("p",null,"Music apps often need an automated way to show the progress of a playing track.\nFor this purpose, we created ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/hooks"},"the hook: ",(0,o.kt)("inlineCode",{parentName:"a"},"useProgress"))," which\nupdates itself automatically."),(0,o.kt)("h4",{id:"example-1"},"Example"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import TrackPlayer, { useProgress } from 'react-native-track-player';\n\nconst MyPlayerBar = () => {\n const progress = useProgress();\n\n return (\n // Note: formatTime and ProgressBar are just examples:\n \n {formatTime(progress.position)}\n \n \n );\n\n}\n")),(0,o.kt)("h2",{id:"track-player-options"},"Track Player Options"),(0,o.kt)("p",null,"Track Player can be configured using a number of options. Some of these options\npertain to the media controls available in the lockscreen / notification and how\nthey behave, others describe the availability of capabilities needed for\nplatform specific functionalities like Android Auto."),(0,o.kt)("p",null,"You can change options multiple times. You do not need to specify all the\noptions, just the ones you want to change."),(0,o.kt)("p",null,"For more information about the properties you can set, ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/functions/player#updateoptionsoptions"},"check the\ndocumentation"),"."),(0,o.kt)("h4",{id:"example-2"},"Example"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"import TrackPlayer, { Capability } from 'react-native-track-player';\n\nTrackPlayer.updateOptions({\n // Media controls capabilities\n capabilities: [\n Capability.Play,\n Capability.Pause,\n Capability.SkipToNext,\n Capability.SkipToPrevious,\n Capability.Stop,\n ],\n\n // Capabilities that will show up when the notification is in the compact form on Android\n compactCapabilities: [Capability.Play, Capability.Pause],\n\n // Icons for the notification on Android (if you don't like the default ones)\n playIcon: require('./play-icon.png'),\n pauseIcon: require('./pause-icon.png'),\n stopIcon: require('./stop-icon.png'),\n previousIcon: require('./previous-icon.png'),\n nextIcon: require('./next-icon.png'),\n icon: require('./notification-icon.png')\n});\n")))}k.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[8555],{3905:function(e,t,a){a.d(t,{Zo:function(){return p},kt:function(){return k}});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=c(a),k=r,y=d["".concat(s,".").concat(k)]||d[k]||u[k]||o;return a?n.createElement(y,i(i({ref:t},p),{},{components:a})):n.createElement(y,i({ref:t},p))}));function k(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c require('./service'));\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},'// service.js\nmodule.exports = async function() {\n // This service needs to be registered for the module to work\n // but it will be used later in the "Receiving Events" section\n}\n')),(0,o.kt)("p",null,"Then, you need to set up the player. This usually takes less than a second:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"import TrackPlayer from 'react-native-track-player';\n\nawait TrackPlayer.setupPlayer()\n// The player is ready to be used\n")),(0,o.kt)("p",null,"Make sure the setup method has completed before interacting with any other functions in ",(0,o.kt)("inlineCode",{parentName:"p"},"TrackPlayer")," in order to avoid instability."),(0,o.kt)("h2",{id:"controlling-the-player"},"Controlling the Player"),(0,o.kt)("h3",{id:"adding-tracks-to-the-playback-queue"},"Adding Tracks to the Playback Queue"),(0,o.kt)("p",null,"You can add a track to the player using a url or by requiring a file in the app\nbundle or on the file system."),(0,o.kt)("p",null,"First of all, you need to create a ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/objects/track"},"track object"),", which\nis a plain javascript object with a number of properties describing the track.\nThen add the track to the queue:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"var track1 = {\n url: 'http://example.com/avaritia.mp3', // Load media from the network\n title: 'Avaritia',\n artist: 'deadmau5',\n album: 'while(1<2)',\n genre: 'Progressive House, Electro House',\n date: '2014-05-20T07:00:00+00:00', // RFC 3339\n artwork: 'http://example.com/cover.png', // Load artwork from the network\n duration: 402 // Duration in seconds\n};\n\nconst track2 = {\n url: require('./coelacanth.ogg'), // Load media from the app bundle\n title: 'Coelacanth I',\n artist: 'deadmau5',\n artwork: require('./cover.jpg'), // Load artwork from the app bundle\n duration: 166\n};\n\nconst track3 = {\n url: 'file:///storage/sdcard0/Downloads/artwork.png', // Load media from the file system\n title: 'Ice Age',\n artist: 'deadmau5',\n // Load artwork from the file system:\n artwork: 'file:///storage/sdcard0/Downloads/cover.png',\n duration: 411\n};\n\n// You can then [add](https://rntp.dev/docs/api/functions/queue#addtracks-insertbeforeindex) the items to the queue\nawait TrackPlayer.add([track1, track2, track3]);\n")),(0,o.kt)("h3",{id:"player-information"},"Player Information"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"\nimport TrackPlayer, { State } from 'react-native-track-player';\n\nconst state = await TrackPlayer.getState();\nif (state === State.Playing) {\n console.log('The player is playing');\n};\n\nlet trackIndex = await TrackPlayer.getCurrentTrack();\nlet trackObject = await TrackPlayer.getTrack(trackIndex);\nconsole.log(`Title: ${trackObject.title}`);\n\nconst position = await TrackPlayer.getPosition();\nconst duration = await TrackPlayer.getDuration();\nconsole.log(`${duration - position} seconds left.`);\n")),(0,o.kt)("h3",{id:"changing-playback-state"},"Changing Playback State"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"TrackPlayer.play();\nTrackPlayer.pause();\nTrackPlayer.reset();\n\n// Seek to 12.5 seconds:\nTrackPlayer.seekTo(12.5);\n\n// Set volume to 50%:\nTrackPlayer.setVolume(0.5);\n")),(0,o.kt)("h3",{id:"controlling-the-queue"},"Controlling the Queue"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"// Skip to a specific track index:\nawait TrackPlayer.skip(trackIndex);\n\n// Skip to the next track in the queue:\nawait TrackPlayer.skipToNext();\n\n// Skip to the previous track in the queue:\nawait TrackPlayer.skipToPrevious();\n\n// Remove two tracks from the queue:\nawait TrackPlayer.remove([trackIndex1, trackIndex2]);\n\n// Retrieve the track objects in the queue:\nconst tracks = await TrackPlayer.getQueue();\nconsole.log(`First title: ${tracks[0].title}`);\n")),(0,o.kt)("h4",{id:"playback-events"},"Playback Events"),(0,o.kt)("p",null,"You can subscribe to ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/events#player"},"player events"),", which describe the\nchanging nature of the playback state. For example, subscribe to the\n",(0,o.kt)("inlineCode",{parentName:"p"},"Event.PlaybackTrackChanged")," event to be notified when the track has changed or\nsubscribe to the ",(0,o.kt)("inlineCode",{parentName:"p"},"Event.PlaybackState")," event to be notified when the player\nbuffers, plays, pauses and stops."),(0,o.kt)("h4",{id:"example"},"Example"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import TrackPlayer, { Event } from 'react-native-track-player';\n\nconst PlayerInfo = () => {\n const [trackTitle, setTrackTitle] = useState();\n\n // do initial setup, set initial trackTitle..\n\n useTrackPlayerEvents([Event.PlaybackTrackChanged], async event => {\n if (event.type === Event.PlaybackTrackChanged && event.nextTrack != null) {\n const track = await TrackPlayer.getTrack(event.nextTrack);\n const {title} = track || {};\n setTrackTitle(title);\n }\n });\n\n return (\n {trackTitle}\n );\n}\n")),(0,o.kt)("h2",{id:"progress-updates"},"Progress Updates"),(0,o.kt)("p",null,"Music apps often need an automated way to show the progress of a playing track.\nFor this purpose, we created ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/hooks"},"the hook: ",(0,o.kt)("inlineCode",{parentName:"a"},"useProgress"))," which\nupdates itself automatically."),(0,o.kt)("h4",{id:"example-1"},"Example"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import TrackPlayer, { useProgress } from 'react-native-track-player';\n\nconst MyPlayerBar = () => {\n const progress = useProgress();\n\n return (\n // Note: formatTime and ProgressBar are just examples:\n \n {formatTime(progress.position)}\n \n \n );\n\n}\n")),(0,o.kt)("h2",{id:"track-player-options"},"Track Player Options"),(0,o.kt)("p",null,"Track Player can be configured using a number of options. Some of these options\npertain to the media controls available in the lockscreen / notification and how\nthey behave, others describe the availability of capabilities needed for\nplatform specific functionalities like Android Auto."),(0,o.kt)("p",null,"You can change options multiple times. You do not need to specify all the\noptions, just the ones you want to change."),(0,o.kt)("p",null,"For more information about the properties you can set, ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/functions/player#updateoptionsoptions"},"check the\ndocumentation"),"."),(0,o.kt)("h4",{id:"example-2"},"Example"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"import TrackPlayer, { Capability } from 'react-native-track-player';\n\nTrackPlayer.updateOptions({\n // Media controls capabilities\n capabilities: [\n Capability.Play,\n Capability.Pause,\n Capability.SkipToNext,\n Capability.SkipToPrevious,\n Capability.Stop,\n ],\n\n // Capabilities that will show up when the notification is in the compact form on Android\n compactCapabilities: [Capability.Play, Capability.Pause],\n\n // Icons for the notification on Android (if you don't like the default ones)\n playIcon: require('./play-icon.png'),\n pauseIcon: require('./pause-icon.png'),\n stopIcon: require('./stop-icon.png'),\n previousIcon: require('./previous-icon.png'),\n nextIcon: require('./next-icon.png'),\n icon: require('./notification-icon.png')\n});\n")))}k.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9dc704f3.b6581e66.js b/assets/js/9dc704f3.b6581e66.js new file mode 100644 index 000000000..b02a05012 --- /dev/null +++ b/assets/js/9dc704f3.b6581e66.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1761],{3905:function(e,r,t){t.d(r,{Zo:function(){return p},kt:function(){return m}});var n=t(7294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function c(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=n.createContext({}),u=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},p=function(e){var r=u(e.components);return n.createElement(s.Provider,{value:r},e.children)},l={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,c=e.originalType,s=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),f=u(t),m=o,d=f["".concat(s,".").concat(m)]||f[m]||l[m]||c;return t?n.createElement(d,i(i({ref:r},p),{},{components:t})):n.createElement(d,i({ref:r},p))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var c=t.length,i=new Array(c);i[0]=f;var a={};for(var s in r)hasOwnProperty.call(r,s)&&(a[s]=r[s]);a.originalType=e,a.mdxType="string"==typeof e?e:o,i[1]=a;for(var u=2;u=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),f=s(n),d=o,y=f["".concat(c,".").concat(d)]||f[d]||u[d]||a;return n?r.createElement(y,i(i({ref:t},p),{},{components:n})):r.createElement(y,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var s=2;s=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var d=n.createContext({}),m=function(t){var e=n.useContext(d),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},k=function(t){var e=m(t.components);return n.createElement(d.Provider,{value:e},t.children)},N={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},o=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,d=t.parentName,k=p(t,["components","mdxType","originalType","parentName"]),o=m(a),c=r,g=o["".concat(d,".").concat(c)]||o[c]||N[c]||l;return a?n.createElement(g,i(i({ref:e},k),{},{components:a})):n.createElement(g,i({ref:e},k))}));function c(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=o;var p={};for(var d in e)hasOwnProperty.call(e,d)&&(p[d]=e[d]);p.originalType=t,p.mdxType="string"==typeof t?t:r,i[1]=p;for(var m=2;m=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var d=n.createContext({}),m=function(t){var e=n.useContext(d),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},k=function(t){var e=m(t.components);return n.createElement(d.Provider,{value:e},t.children)},N={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},o=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,d=t.parentName,k=p(t,["components","mdxType","originalType","parentName"]),o=m(a),c=r,g=o["".concat(d,".").concat(c)]||o[c]||N[c]||l;return a?n.createElement(g,i(i({ref:e},k),{},{components:a})):n.createElement(g,i({ref:e},k))}));function c(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=o;var p={};for(var d in e)hasOwnProperty.call(e,d)&&(p[d]=e[d]);p.originalType=t,p.mdxType="string"==typeof t?t:r,i[1]=p;for(var m=2;m=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=o.createContext({}),p=function(e){var t=o.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return o.createElement(c.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=p(n),b=r,k=d["".concat(c,".").concat(b)]||d[b]||s[b]||a;return n?o.createElement(k,i(i({ref:t},u),{},{components:n})):o.createElement(k,i({ref:t},u))}));function b(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var p=2;p=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),d=l(r),y=a,m=d["".concat(s,".").concat(y)]||d[y]||u[y]||o;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l PlaybackService);\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"// src/services/PlaybackService.ts\nimport { Event } from 'react-native-track-player';\n\nexport const PlaybackService = async function() {\n\n TrackPlayer.addEventListener(Event.RemotePlay, () => TrackPlayer.play());\n\n TrackPlayer.addEventListener(Event.RemotePause, () => TrackPlayer.pause());\n\n // ...\n\n};\n")))}y.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[4546],{3905:function(e,t,r){r.d(t,{Zo:function(){return p},kt:function(){return y}});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),d=l(r),y=a,m=d["".concat(s,".").concat(y)]||d[y]||u[y]||o;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l PlaybackService);\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"// src/services/PlaybackService.ts\nimport { Event } from 'react-native-track-player';\n\nexport const PlaybackService = async function() {\n\n TrackPlayer.addEventListener(Event.RemotePlay, () => TrackPlayer.play());\n\n TrackPlayer.addEventListener(Event.RemotePause, () => TrackPlayer.pause());\n\n // ...\n\n};\n")))}y.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b3f20807.7212284d.js b/assets/js/b3f20807.7212284d.js new file mode 100644 index 000000000..0a388feea --- /dev/null +++ b/assets/js/b3f20807.7212284d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1839],{3905:function(e,t,o){o.d(t,{Zo:function(){return s},kt:function(){return y}});var n=o(7294);function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function i(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),o=t;return e&&(o="function"==typeof e?e(t):i(i({},t),e)),o},s=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=p(o),y=r,m=d["".concat(l,".").concat(y)]||d[y]||u[y]||a;return o?n.createElement(m,i(i({ref:t},s),{},{components:o})):n.createElement(m,i({ref:t},s))}));function y(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=o.length,i=new Array(a);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var p=2;pPlayback",id:"playback",level:2},{value:"PlayAndRecord",id:"playandrecord",level:2},{value:"MultiRoute",id:"multiroute",level:2},{value:"Ambient",id:"ambient",level:2},{value:"SoloAmbient",id:"soloambient",level:2},{value:"Record",id:"record",level:2}],d={toc:u};function y(e){var t=e.components,o=(0,r.Z)(e,i);return(0,a.kt)("wrapper",(0,n.Z)({},d,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"ios-category-ios-only"},"iOS Category (ios-only)"),(0,a.kt)("p",null,"All iOS Category types are made available through the named export ",(0,a.kt)("inlineCode",{parentName:"p"},"IOSCategory"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"import { IOSCategory } from 'react-native-track-player';\n")),(0,a.kt)("h2",{id:"playback"},(0,a.kt)("inlineCode",{parentName:"h2"},"Playback")),(0,a.kt)("p",null,"The category for playing recorded music or other sounds that are central to the\nsuccessful use of your app."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616509-playback"},"See the Apple Docs")),(0,a.kt)("h2",{id:"playandrecord"},(0,a.kt)("inlineCode",{parentName:"h2"},"PlayAndRecord")),(0,a.kt)("p",null,"The category for recording (input) and playback (output) of audio, such as for a\nVoice over Internet Protocol (VoIP) app."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616568-playandrecord"},"See the Apple Docs")),(0,a.kt)("h2",{id:"multiroute"},(0,a.kt)("inlineCode",{parentName:"h2"},"MultiRoute")),(0,a.kt)("p",null,"The category for routing distinct streams of audio data to different output\ndevices at the same time."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616484-multiroute"},"See the Apple Docs")," "),(0,a.kt)("h2",{id:"ambient"},(0,a.kt)("inlineCode",{parentName:"h2"},"Ambient")),(0,a.kt)("p",null,"The category for an app in which sound playback is nonprimary \u2014 that is, your\napp also works with the sound turned off."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616560-ambient"},"See the Apple Docs")),(0,a.kt)("h2",{id:"soloambient"},(0,a.kt)("inlineCode",{parentName:"h2"},"SoloAmbient")),(0,a.kt)("p",null,"The default audio session category."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616488-soloambient"},"See the Apple Docs")),(0,a.kt)("h2",{id:"record"},(0,a.kt)("inlineCode",{parentName:"h2"},"Record")),(0,a.kt)("p",null,"The category for recording audio while also silencing playback audio."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616451-record"},"See the Apple Docs")))}y.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7c3fde0a.a428afa3.js b/assets/js/b8b88847.d002ff5a.js similarity index 94% rename from assets/js/7c3fde0a.a428afa3.js rename to assets/js/b8b88847.d002ff5a.js index ba7bb9447..f567a48c2 100644 --- a/assets/js/7c3fde0a.a428afa3.js +++ b/assets/js/b8b88847.d002ff5a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[4143],{3905:function(t,e,n){n.d(e,{Zo:function(){return c},kt:function(){return m}});var a=n(7294);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function o(t){for(var e=1;e=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var p=a.createContext({}),d=function(t){var e=a.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):o(o({},e),t)),n},c=function(t){var e=d(t.components);return a.createElement(p.Provider,{value:e},t.children)},s={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},u=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,i=t.originalType,p=t.parentName,c=l(t,["components","mdxType","originalType","parentName"]),u=d(n),m=r,y=u["".concat(p,".").concat(m)]||u[m]||s[m]||i;return n?a.createElement(y,o(o({ref:e},c),{},{components:n})):a.createElement(y,o({ref:e},c))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var i=n.length,o=new Array(i);o[0]=u;var l={};for(var p in e)hasOwnProperty.call(e,p)&&(l[p]=e[p]);l.originalType=t,l.mdxType="string"==typeof t?t:r,o[1]=l;for(var d=2;d=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var p=a.createContext({}),d=function(t){var e=a.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):o(o({},e),t)),n},c=function(t){var e=d(t.components);return a.createElement(p.Provider,{value:e},t.children)},s={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},u=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,i=t.originalType,p=t.parentName,c=l(t,["components","mdxType","originalType","parentName"]),u=d(n),m=r,y=u["".concat(p,".").concat(m)]||u[m]||s[m]||i;return n?a.createElement(y,o(o({ref:e},c),{},{components:n})):a.createElement(y,o({ref:e},c))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var i=n.length,o=new Array(i);o[0]=u;var l={};for(var p in e)hasOwnProperty.call(e,p)&&(l[p]=e[p]);l.originalType=t,l.mdxType="string"==typeof t?t:r,o[1]=l;for(var d=2;d=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var p=n.createContext({}),l=function(e){var t=n.useContext(p),o=t;return e&&(o="function"==typeof e?e(t):i(i({},t),e)),o},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=l(o),h=r,m=d["".concat(p,".").concat(h)]||d[h]||c[h]||a;return o?n.createElement(m,i(i({ref:t},u),{},{components:o})):n.createElement(m,i({ref:t},u))}));function h(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=o.length,i=new Array(a);i[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;lMixWithOthers",id:"mixwithothers",level:2},{value:"DuckOthers",id:"duckothers",level:2},{value:"InterruptSpokenAudioAndMixWithOthers",id:"interruptspokenaudioandmixwithothers",level:2},{value:"AllowBluetooth",id:"allowbluetooth",level:2},{value:"AllowBluetoothA2DP",id:"allowbluetootha2dp",level:2},{value:"AllowAirPlay",id:"allowairplay",level:2},{value:"DefaultToSpeaker",id:"defaulttospeaker",level:2}],d={toc:c};function h(e){var t=e.components,o=(0,r.Z)(e,i);return(0,a.kt)("wrapper",(0,n.Z)({},d,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"ios-category-options-ios-only"},"iOS Category Options (ios-only)"),(0,a.kt)("p",null,"All iOS Category Options types are made available through the named export ",(0,a.kt)("inlineCode",{parentName:"p"},"IOSCategoryOptions"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"import { IOSCategoryOptions } from 'react-native-track-player';\n")),(0,a.kt)("h2",{id:"mixwithothers"},(0,a.kt)("inlineCode",{parentName:"h2"},"MixWithOthers")),(0,a.kt)("p",null,"An option that indicates whether audio from this session mixes with audio\nfrom active sessions in other audio apps."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616611-mixwithothers"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"duckothers"},(0,a.kt)("inlineCode",{parentName:"h2"},"DuckOthers")),(0,a.kt)("p",null,"An option that reduces the volume of other audio sessions while audio from\nthis session plays."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616618-duckothers"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"interruptspokenaudioandmixwithothers"},(0,a.kt)("inlineCode",{parentName:"h2"},"InterruptSpokenAudioAndMixWithOthers")),(0,a.kt)("p",null,"An option that determines whether to pause spoken audio content from other\nsessions when your app plays its audio."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616534-interruptspokenaudioandmixwithot"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"allowbluetooth"},(0,a.kt)("inlineCode",{parentName:"h2"},"AllowBluetooth")),(0,a.kt)("p",null,"An option that determines whether Bluetooth hands-free devices appear as\navailable input routes."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616518-allowbluetooth"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"allowbluetootha2dp"},(0,a.kt)("inlineCode",{parentName:"h2"},"AllowBluetoothA2DP")),(0,a.kt)("p",null,"An option that determines whether you can stream audio from this session\nto Bluetooth devices that support the Advanced Audio Distribution Profile (A2DP)."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1771735-allowbluetootha2dp"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"allowairplay"},(0,a.kt)("inlineCode",{parentName:"h2"},"AllowAirPlay")),(0,a.kt)("p",null,"An option that determines whether you can stream audio from this session\nto AirPlay devices."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1771736-allowairplay"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"defaulttospeaker"},(0,a.kt)("inlineCode",{parentName:"h2"},"DefaultToSpeaker")),(0,a.kt)("p",null,"An option that determines whether audio from the session defaults to the\nbuilt-in speaker instead of the receiver."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616462-defaulttospeaker"},"See the Apple Docs ")))}h.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bcb5a753.e1f6d559.js b/assets/js/bcb5a753.e1f6d559.js deleted file mode 100644 index 3959eb8a5..000000000 --- a/assets/js/bcb5a753.e1f6d559.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[8011],{3905:function(e,t,o){o.d(t,{Zo:function(){return u},kt:function(){return h}});var n=o(7294);function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function i(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var p=n.createContext({}),l=function(e){var t=n.useContext(p),o=t;return e&&(o="function"==typeof e?e(t):i(i({},t),e)),o},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=l(o),h=r,m=d["".concat(p,".").concat(h)]||d[h]||c[h]||a;return o?n.createElement(m,i(i({ref:t},u),{},{components:o})):n.createElement(m,i({ref:t},u))}));function h(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=o.length,i=new Array(a);i[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;lMixWithOthers",id:"mixwithothers",level:2},{value:"DuckOthers",id:"duckothers",level:2},{value:"InterruptSpokenAudioAndMixWithOthers",id:"interruptspokenaudioandmixwithothers",level:2},{value:"AllowBluetooth",id:"allowbluetooth",level:2},{value:"AllowBluetoothA2DP",id:"allowbluetootha2dp",level:2},{value:"AllowAirPlay",id:"allowairplay",level:2},{value:"DefaultToSpeaker",id:"defaulttospeaker",level:2}],d={toc:c};function h(e){var t=e.components,o=(0,r.Z)(e,i);return(0,a.kt)("wrapper",(0,n.Z)({},d,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"ios-category-options-ios-only"},"iOS Category Options (ios-only)"),(0,a.kt)("p",null,"All iOS Category Options types are made available through the named export ",(0,a.kt)("inlineCode",{parentName:"p"},"IOSCategoryOptions"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"import { IOSCategoryOptions } from 'react-native-track-player';\n")),(0,a.kt)("h2",{id:"mixwithothers"},(0,a.kt)("inlineCode",{parentName:"h2"},"MixWithOthers")),(0,a.kt)("p",null,"An option that indicates whether audio from this session mixes with audio\nfrom active sessions in other audio apps."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616611-mixwithothers"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"duckothers"},(0,a.kt)("inlineCode",{parentName:"h2"},"DuckOthers")),(0,a.kt)("p",null,"An option that reduces the volume of other audio sessions while audio from\nthis session plays."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616618-duckothers"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"interruptspokenaudioandmixwithothers"},(0,a.kt)("inlineCode",{parentName:"h2"},"InterruptSpokenAudioAndMixWithOthers")),(0,a.kt)("p",null,"An option that determines whether to pause spoken audio content from other\nsessions when your app plays its audio."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616534-interruptspokenaudioandmixwithot"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"allowbluetooth"},(0,a.kt)("inlineCode",{parentName:"h2"},"AllowBluetooth")),(0,a.kt)("p",null,"An option that determines whether Bluetooth hands-free devices appear as\navailable input routes."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616518-allowbluetooth"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"allowbluetootha2dp"},(0,a.kt)("inlineCode",{parentName:"h2"},"AllowBluetoothA2DP")),(0,a.kt)("p",null,"An option that determines whether you can stream audio from this session\nto Bluetooth devices that support the Advanced Audio Distribution Profile (A2DP)."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1771735-allowbluetootha2dp"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"allowairplay"},(0,a.kt)("inlineCode",{parentName:"h2"},"AllowAirPlay")),(0,a.kt)("p",null,"An option that determines whether you can stream audio from this session\nto AirPlay devices."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1771736-allowairplay"},"See the Apple Docs ")),(0,a.kt)("h2",{id:"defaulttospeaker"},(0,a.kt)("inlineCode",{parentName:"h2"},"DefaultToSpeaker")),(0,a.kt)("p",null,"An option that determines whether audio from the session defaults to the\nbuilt-in speaker instead of the receiver."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions/1616462-defaulttospeaker"},"See the Apple Docs ")))}h.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c3b68060.0132ea4b.js b/assets/js/c3b68060.0132ea4b.js new file mode 100644 index 000000000..29b1386a2 --- /dev/null +++ b/assets/js/c3b68060.0132ea4b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[4870],{3905:function(t,e,n){n.d(e,{Zo:function(){return s},kt:function(){return d}});var r=n(7294);function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e=0||(a[n]=t[n]);return a}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}var c=r.createContext({}),p=function(t){var e=r.useContext(c),n=e;return t&&(n="function"==typeof t?t(e):i(i({},e),t)),n},s=function(t){var e=p(t.components);return r.createElement(c.Provider,{value:e},t.children)},u={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},m=r.forwardRef((function(t,e){var n=t.components,a=t.mdxType,o=t.originalType,c=t.parentName,s=l(t,["components","mdxType","originalType","parentName"]),m=p(n),d=a,h=m["".concat(c,".").concat(d)]||m[d]||u[d]||o;return n?r.createElement(h,i(i({ref:e},s),{},{components:n})):r.createElement(h,i({ref:e},s))}));function d(t,e){var n=arguments,a=e&&e.mdxType;if("string"==typeof t||a){var o=n.length,i=new Array(o);i[0]=m;var l={};for(var c in e)hasOwnProperty.call(e,c)&&(l[c]=e[c]);l.originalType=t,l.mdxType="string"==typeof t?t:a,i[1]=l;for(var p=2;p=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=s(r),m=a,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,i(i({ref:t},l),{},{components:r})):n.createElement(f,i({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var s=2;s=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(t),m=o,f=u["".concat(s,".").concat(m)]||u[m]||c[m]||a;return t?r.createElement(f,i(i({ref:n},d),{},{components:t})):r.createElement(f,i({ref:n},d))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;pstopWithApp is now android.appKilledPlaybackBehavior",id:"stopwithapp-is-now-androidappkilledplaybackbehavior",level:3},{value:"destroy and stop have been removed",id:"destroy-and-stop-have-been-removed",level:3},{value:"Configuration Changes",id:"configuration-changes",level:2},{value:"track-player.json / Build Preferences no longer needed",id:"track-playerjson--build-preferences-no-longer-needed",level:3},{value:"Minimum Compile/Target SDK",id:"minimum-compiletarget-sdk",level:3}],u={toc:c};function m(e){var n=e.components,t=(0,o.Z)(e,i);return(0,a.kt)("wrapper",(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"migrating-from-v2-to-v3"},"Migrating from v2 to v3"),(0,a.kt)("p",null,"Due to how Android handles foreground services, it's not possible for us to stop the process manually, as it's waiting for the foreground service to come back. With v3 we are introducing the following changes related to this:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"On Android, the audio service can't be manually stopped by the app anymore.\nThe OS itself decides when to stop it."),(0,a.kt)("li",{parentName:"ul"},"An audio control notification will ",(0,a.kt)("em",{parentName:"li"},"always")," be present (depending on phone\nvendor, this would look and behave differently), which allows users to\nquickly go back to the app by tapping on it.")),(0,a.kt)("p",null,"The full changelog of added features and bug fixes ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/doublesymmetry/react-native-track-player/releases/tag/v3.0"},"can be found here"),"."),(0,a.kt)("p",null,"When migrating from v2 to v3, the following has changed:"),(0,a.kt)("h2",{id:"api-changes"},"API Changes"),(0,a.kt)("h3",{id:"stopwithapp-is-now-androidappkilledplaybackbehavior"},(0,a.kt)("inlineCode",{parentName:"h3"},"stopWithApp")," is now ",(0,a.kt)("inlineCode",{parentName:"h3"},"android.appKilledPlaybackBehavior")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"// Methods\nawait TrackPlayer.updateOptions({\n- stopWithApp: true,\n+ android: {\n+ appKilledPlaybackBehavior: AppKilledPlaybackBehavior.ContinuePlayback\n+ }\n});\n")),(0,a.kt)("h3",{id:"destroy-and-stop-have-been-removed"},(0,a.kt)("inlineCode",{parentName:"h3"},"destroy")," and ",(0,a.kt)("inlineCode",{parentName:"h3"},"stop")," have been removed"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"// remove all usages of `.destroy()` and `.stop()`\n- TrackPlayer.destroy();\n- TrackPlayer.stop();\n")),(0,a.kt)("h2",{id:"configuration-changes"},"Configuration Changes"),(0,a.kt)("h3",{id:"track-playerjson--build-preferences-no-longer-needed"},(0,a.kt)("inlineCode",{parentName:"h3"},"track-player.json")," / Build Preferences no longer needed"),(0,a.kt)("p",null,"HLS, Dash, & Smoothstreaming are now supported on Android out of the box. You\ncan remove your ",(0,a.kt)("inlineCode",{parentName:"p"},"track-player.json")," file if you have one. You still need to\nensure that ",(0,a.kt)("a",{parentName:"p",href:"/docs/4.0/api/objects/track"},"the correct ",(0,a.kt)("inlineCode",{parentName:"a"},"type")," is specified on your ",(0,a.kt)("inlineCode",{parentName:"a"},"Track"),"\nobject"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- track-player.json\n")),(0,a.kt)("h3",{id:"minimum-compiletarget-sdk"},"Minimum Compile/Target SDK"),(0,a.kt)("p",null,"You also need to have a minimum compile & target SDK of 31 (Android 12)"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-groovy"},"// android/build.gradle\n...\n compileSdkVersion = 31\n targetSdkVersion = 31\n...\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d2277970.54f1d1aa.js b/assets/js/d2277970.54f1d1aa.js deleted file mode 100644 index cc341fa7f..000000000 --- a/assets/js/d2277970.54f1d1aa.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[222],{3905:function(e,n,t){t.d(n,{Zo:function(){return d},kt:function(){return m}});var r=t(7294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),p=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},d=function(e){var n=p(e.components);return r.createElement(s.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(t),m=o,f=u["".concat(s,".").concat(m)]||u[m]||c[m]||a;return t?r.createElement(f,i(i({ref:n},d),{},{components:t})):r.createElement(f,i({ref:n},d))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;pstopWithApp is now android.appKilledPlaybackBehavior",id:"stopwithapp-is-now-androidappkilledplaybackbehavior",level:3},{value:"destroy and stop have been removed",id:"destroy-and-stop-have-been-removed",level:3},{value:"Configuration Changes",id:"configuration-changes",level:2},{value:"track-player.json / Build Preferences no longer needed",id:"track-playerjson--build-preferences-no-longer-needed",level:3},{value:"Minimum Compile/Target SDK",id:"minimum-compiletarget-sdk",level:3}],u={toc:c};function m(e){var n=e.components,t=(0,o.Z)(e,i);return(0,a.kt)("wrapper",(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"migrating-from-v2-to-v3"},"Migrating from v2 to v3"),(0,a.kt)("p",null,"Due to how Android handles foreground services, it's not possible for us to stop the process manually, as it's waiting for the foreground service to come back. With v3 we are introducing the following changes related to this:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"On Android, the audio service can't be manually stopped by the app anymore.\nThe OS itself decides when to stop it."),(0,a.kt)("li",{parentName:"ul"},"An audio control notification will ",(0,a.kt)("em",{parentName:"li"},"always")," be present (depending on phone\nvendor, this would look and behave differently), which allows users to\nquickly go back to the app by tapping on it.")),(0,a.kt)("p",null,"The full changelog of added features and bug fixes ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/doublesymmetry/react-native-track-player/releases/tag/v3.0"},"can be found here"),"."),(0,a.kt)("p",null,"When migrating from v2 to v3, the following has changed:"),(0,a.kt)("h2",{id:"api-changes"},"API Changes"),(0,a.kt)("h3",{id:"stopwithapp-is-now-androidappkilledplaybackbehavior"},(0,a.kt)("inlineCode",{parentName:"h3"},"stopWithApp")," is now ",(0,a.kt)("inlineCode",{parentName:"h3"},"android.appKilledPlaybackBehavior")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"// Methods\nawait TrackPlayer.updateOptions({\n- stopWithApp: true,\n+ android: {\n+ appKilledPlaybackBehavior: AppKilledPlaybackBehavior.ContinuePlayback\n+ }\n});\n")),(0,a.kt)("h3",{id:"destroy-and-stop-have-been-removed"},(0,a.kt)("inlineCode",{parentName:"h3"},"destroy")," and ",(0,a.kt)("inlineCode",{parentName:"h3"},"stop")," have been removed"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"// remove all usages of `.destroy()` and `.stop()`\n- TrackPlayer.destroy();\n- TrackPlayer.stop();\n")),(0,a.kt)("h2",{id:"configuration-changes"},"Configuration Changes"),(0,a.kt)("h3",{id:"track-playerjson--build-preferences-no-longer-needed"},(0,a.kt)("inlineCode",{parentName:"h3"},"track-player.json")," / Build Preferences no longer needed"),(0,a.kt)("p",null,"HLS, Dash, & Smoothstreaming are now supported on Android out of the box. You\ncan remove your ",(0,a.kt)("inlineCode",{parentName:"p"},"track-player.json")," file if you have one. You still need to\nensure that ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/objects/track"},"the correct ",(0,a.kt)("inlineCode",{parentName:"a"},"type")," is specified on your ",(0,a.kt)("inlineCode",{parentName:"a"},"Track"),"\nobject"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-diff"},"- track-player.json\n")),(0,a.kt)("h3",{id:"minimum-compiletarget-sdk"},"Minimum Compile/Target SDK"),(0,a.kt)("p",null,"You also need to have a minimum compile & target SDK of 31 (Android 12)"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-groovy"},"// android/build.gradle\n...\n compileSdkVersion = 31\n targetSdkVersion = 31\n...\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/32562f03.42319b56.js b/assets/js/d4a334ea.243f842c.js similarity index 98% rename from assets/js/32562f03.42319b56.js rename to assets/js/d4a334ea.243f842c.js index 5998e147b..fa131a3d2 100644 --- a/assets/js/32562f03.42319b56.js +++ b/assets/js/d4a334ea.243f842c.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[7472],{3634:function(e){e.exports=JSON.parse('{"pluginId":"default","version":"4.0","label":"4.0","banner":null,"badge":true,"className":"docs-version-4.0","isLast":true,"docsSidebars":{"app":[{"type":"link","label":"Intro","href":"/docs/intro","docId":"intro"},{"type":"category","label":"The Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/basics/installation","docId":"basics/installation"},{"type":"link","label":"Getting Started","href":"/docs/basics/getting-started","docId":"basics/getting-started"},{"type":"link","label":"Playback Service","href":"/docs/basics/playback-service","docId":"basics/playback-service"},{"type":"link","label":"Background Mode","href":"/docs/basics/background-mode","docId":"basics/background-mode"},{"type":"link","label":"Platform Support","href":"/docs/basics/platform-support","docId":"basics/platform-support"}]},{"type":"category","label":"API Reference","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Events","href":"/docs/api/events","docId":"api/events"},{"type":"category","label":"Functions","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Lifecycle","href":"/docs/api/functions/lifecycle","docId":"api/functions/lifecycle"},{"type":"link","label":"Player","href":"/docs/api/functions/player","docId":"api/functions/player"},{"type":"link","label":"Queue","href":"/docs/api/functions/queue","docId":"api/functions/queue"}]},{"type":"link","label":"Hooks","href":"/docs/api/hooks","docId":"api/hooks"},{"type":"category","label":"Constants","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"State","href":"/docs/api/constants/state","docId":"api/constants/state"},{"type":"link","label":"Capability","href":"/docs/api/constants/capability","docId":"api/constants/capability"},{"type":"link","label":"Rating","href":"/docs/api/constants/rating","docId":"api/constants/rating"},{"type":"link","label":"Repeat Mode","href":"/docs/api/constants/repeat-mode","docId":"api/constants/repeat-mode"},{"type":"link","label":"Pitch Algorithm (ios-only)","href":"/docs/api/constants/pitch-algorithm","docId":"api/constants/pitch-algorithm"},{"type":"link","label":"App Killed Playback Behavior (android-only)","href":"/docs/api/constants/app-killed-playback-behavior","docId":"api/constants/app-killed-playback-behavior"},{"type":"link","label":"iOS Category (ios-only)","href":"/docs/api/constants/ios-category","docId":"api/constants/ios-category"},{"type":"link","label":"iOS Category Mode (ios-only)","href":"/docs/api/constants/ios-category-mode","docId":"api/constants/ios-category-mode"},{"type":"link","label":"iOS Category Options (ios-only)","href":"/docs/api/constants/ios-category-options","docId":"api/constants/ios-category-options"}]},{"type":"category","label":"Objects","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Track","href":"/docs/api/objects/track","docId":"api/objects/track"},{"type":"link","label":"Feedback","href":"/docs/api/objects/feedback","docId":"api/objects/feedback"},{"type":"link","label":"AndroidOptions","href":"/docs/api/objects/android-options","docId":"api/objects/android-options"},{"type":"link","label":"\u26a0\ufe0f MetadataOptions","href":"/docs/api/objects/metadata-options","docId":"api/objects/metadata-options"},{"type":"link","label":"AudioMetadataReceivedEvent","href":"/docs/api/objects/metadata","docId":"api/objects/metadata"},{"type":"link","label":"PlaybackErrorEvent","href":"/docs/api/objects/playback-error-event","docId":"api/objects/playback-error-event"},{"type":"link","label":"PlaybackState","href":"/docs/api/objects/playback-state","docId":"api/objects/playback-state"},{"type":"link","label":"PlayerOptions","href":"/docs/api/objects/player-options","docId":"api/objects/player-options"},{"type":"link","label":"Progress","href":"/docs/api/objects/progress","docId":"api/objects/progress"},{"type":"link","label":"Resource","href":"/docs/api/objects/resource","docId":"api/objects/resource"},{"type":"link","label":"UpdateOptions","href":"/docs/api/objects/update-options","docId":"api/objects/update-options"}]}]},{"type":"category","label":"Guides","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Offline Playback","href":"/docs/guides/offline-playback","docId":"guides/offline-playback"},{"type":"link","label":"Saving Progress","href":"/docs/guides/saving-progress","docId":"guides/saving-progress"},{"type":"link","label":"Sleeptimers","href":"/docs/guides/sleeptimers","docId":"guides/sleeptimers"},{"type":"link","label":"Multitrack Progress","href":"/docs/guides/multitrack-progress","docId":"guides/multitrack-progress"},{"type":"link","label":"Play Buttons","href":"/docs/guides/play-button","docId":"guides/play-button"},{"type":"link","label":"Amazon FireOS Support","href":"/docs/guides/amazon-fire-support","docId":"guides/amazon-fire-support"}]},{"type":"link","label":"Migrating from v1 to v2","href":"/docs/v2-migration","docId":"v2-migration"},{"type":"link","label":"Migrating from v2 to v3","href":"/docs/v3-migration","docId":"v3-migration"},{"type":"link","label":"Migrating from v3.1.0 to v3.2.0","href":"/docs/v3.1.0-migration","docId":"v3.1.0-migration"},{"type":"link","label":"Migrating from v3.2 to v4","href":"/docs/v4-migration","docId":"v4-migration"},{"type":"link","label":"Troubleshooting","href":"/docs/troubleshooting","docId":"troubleshooting"}]},"docs":{"api/constants/app-killed-playback-behavior":{"id":"api/constants/app-killed-playback-behavior","title":"App Killed Playback Behavior (android-only)","description":"ContinuePlayback (default)","sidebar":"app"},"api/constants/capability":{"id":"api/constants/capability","title":"Capability","description":"All Capability types are made available through the named export Capability:","sidebar":"app"},"api/constants/ios-category":{"id":"api/constants/ios-category","title":"iOS Category (ios-only)","description":"All iOS Category types are made available through the named export IOSCategory:","sidebar":"app"},"api/constants/ios-category-mode":{"id":"api/constants/ios-category-mode","title":"iOS Category Mode (ios-only)","description":"All iOS Category Mode types are made available through the named export IOSCategoryMode:","sidebar":"app"},"api/constants/ios-category-options":{"id":"api/constants/ios-category-options","title":"iOS Category Options (ios-only)","description":"All iOS Category Options types are made available through the named export IOSCategoryOptions:","sidebar":"app"},"api/constants/pitch-algorithm":{"id":"api/constants/pitch-algorithm","title":"Pitch Algorithm (ios-only)","description":"All PitchAlgorithm types are made available through the named export PitchAlgorithm:","sidebar":"app"},"api/constants/rating":{"id":"api/constants/rating","title":"Rating","description":"All RatingType types are made available through the named export RatingType:","sidebar":"app"},"api/constants/repeat-mode":{"id":"api/constants/repeat-mode","title":"Repeat Mode","description":"All RepeatMode types are made available through the named export RepeatMode:","sidebar":"app"},"api/constants/state":{"id":"api/constants/state","title":"State","description":"All State types are made available through the named export State:","sidebar":"app"},"api/events":{"id":"api/events","title":"Events","description":"All event types are made available through the named export Event:","sidebar":"app"},"api/functions/lifecycle":{"id":"api/functions/lifecycle","title":"Lifecycle","description":"setupPlayer(options: PlayerOptions)","sidebar":"app"},"api/functions/player":{"id":"api/functions/player","title":"Player","description":"setupPlayer(options)","sidebar":"app"},"api/functions/queue":{"id":"api/functions/queue","title":"Queue","description":"add(tracks, insertBeforeIndex)","sidebar":"app"},"api/hooks":{"id":"api/hooks","title":"Hooks","description":"React v16.8 introduced hooks. If you are using a version of React Native that is before v0.59.0, your React Native version does not support hooks.","sidebar":"app"},"api/objects/android-options":{"id":"api/objects/android-options","title":"AndroidOptions","description":"Options available for the android player. All options are optional.","sidebar":"app"},"api/objects/feedback":{"id":"api/objects/feedback","title":"Feedback","description":"Controls the rendering of the control center item.","sidebar":"app"},"api/objects/metadata":{"id":"api/objects/metadata","title":"AudioMetadataReceivedEvent","description":"An object representing the timed or chapter metadata received for a track.","sidebar":"app"},"api/objects/metadata-options":{"id":"api/objects/metadata-options","title":"\u26a0\ufe0f MetadataOptions","description":"\u26a0\ufe0f Deprecated in favor of UpdateOptions","sidebar":"app"},"api/objects/playback-error-event":{"id":"api/objects/playback-error-event","title":"PlaybackErrorEvent","description":"An object denoting a playback error encountered during loading or playback of a","sidebar":"app"},"api/objects/playback-state":{"id":"api/objects/playback-state","title":"PlaybackState","description":"An object representing the playback state of the player.","sidebar":"app"},"api/objects/player-options":{"id":"api/objects/player-options","title":"PlayerOptions","description":"All parameters are optional. You also only need to specify the ones you want to update.","sidebar":"app"},"api/objects/progress":{"id":"api/objects/progress","title":"Progress","description":"An object representing the various aspects of the active track.","sidebar":"app"},"api/objects/resource":{"id":"api/objects/resource","title":"Resource","description":"Resource objects are the result of require/import for files.","sidebar":"app"},"api/objects/track":{"id":"api/objects/track","title":"Track","description":"Tracks in the player queue are plain javascript objects as described below.","sidebar":"app"},"api/objects/update-options":{"id":"api/objects/update-options","title":"UpdateOptions","description":"All parameters are optional. You also only need to specify the ones you want to update.","sidebar":"app"},"basics/background-mode":{"id":"basics/background-mode","title":"Background Mode","description":"React Native Track Player supports playing audio while your app is in the","sidebar":"app"},"basics/getting-started":{"id":"basics/getting-started","title":"Getting Started","description":"Starting off","sidebar":"app"},"basics/installation":{"id":"basics/installation","title":"Installation","description":"Stable","sidebar":"app"},"basics/platform-support":{"id":"basics/platform-support","title":"Platform Support","description":"Audio Sources","sidebar":"app"},"basics/playback-service":{"id":"basics/playback-service","title":"Playback Service","description":"The playback service keeps running even when the app is in the background. It will start when the player is set up and will only stop when the player is destroyed. It is a good idea to put any code in there that needs to be directly tied to the player state. For example, if you want to be able to track what is being played for analytics purposes, the playback service would be the place to do so.","sidebar":"app"},"guides/amazon-fire-support":{"id":"guides/amazon-fire-support","title":"Amazon FireOS Support","description":"Support for Android in react-native-track-player is built on top of the ExoPlayer media player library provided by Google. ExoPlayer does not officially support Amazon\'s FireOS fork of Android, because it does not pass Android CTS. ExoPlayer seems to work decently on FireOS 5, but it hardly works at all on FireOS 4.","sidebar":"app"},"guides/multitrack-progress":{"id":"guides/multitrack-progress","title":"Multitrack Progress","description":"If you\'re building an app that allows the playback of more than one Track you\'ll","sidebar":"app"},"guides/offline-playback":{"id":"guides/offline-playback","title":"Offline Playback","description":"There are two general use-cases for offline playback:","sidebar":"app"},"guides/play-button":{"id":"guides/play-button","title":"Play Buttons","description":"UI often needs to display a Play button that changes between three states:","sidebar":"app"},"guides/saving-progress":{"id":"guides/saving-progress","title":"Saving Progress","description":"A common use-case is to store the users progress on a particular Track","sidebar":"app"},"guides/sleeptimers":{"id":"guides/sleeptimers","title":"Sleeptimers","description":"This guide has very similar principles and implementation to","sidebar":"app"},"intro":{"id":"intro","title":"Intro","description":"A fully fledged audio module created for music apps. Provides audio playback, external media controls, background mode and more!","sidebar":"app"},"troubleshooting":{"id":"troubleshooting","title":"Troubleshooting","description":"iOS: (Enable Swift) library not found for -lswiftCoreAudio for architecture x86_64","sidebar":"app"},"v2-migration":{"id":"v2-migration","title":"Migrating from v1 to v2","description":"All queue methods have been updating to work on indexes instead of id\'s. We want this library to support all kinds of apps -- and moving to be index based will allow us to better support applications who have long/endless queues and in the future to allow us to build a performant API around queue management.","sidebar":"app"},"v3-migration":{"id":"v3-migration","title":"Migrating from v2 to v3","description":"Due to how Android handles foreground services, it\'s not possible for us to stop the process manually, as it\'s waiting for the foreground service to come back. With v3 we are introducing the following changes related to this:","sidebar":"app"},"v3.1.0-migration":{"id":"v3.1.0-migration","title":"Migrating from v3.1.0 to v3.2.0","description":"stoppingAppPausesPlayback is deprecated","sidebar":"app"},"v4-migration":{"id":"v4-migration","title":"Migrating from v3.2 to v4","description":"General Additions","sidebar":"app"}}}')}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[3230],{3950:function(e){e.exports=JSON.parse('{"pluginId":"default","version":"4.1","label":"4.1","banner":null,"badge":true,"className":"docs-version-4.1","isLast":true,"docsSidebars":{"app":[{"type":"link","label":"Intro","href":"/docs/intro","docId":"intro"},{"type":"category","label":"The Basics","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Installation","href":"/docs/basics/installation","docId":"basics/installation"},{"type":"link","label":"Getting Started","href":"/docs/basics/getting-started","docId":"basics/getting-started"},{"type":"link","label":"Playback Service","href":"/docs/basics/playback-service","docId":"basics/playback-service"},{"type":"link","label":"Background Mode","href":"/docs/basics/background-mode","docId":"basics/background-mode"},{"type":"link","label":"Platform Support","href":"/docs/basics/platform-support","docId":"basics/platform-support"}]},{"type":"category","label":"API Reference","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Events","href":"/docs/api/events","docId":"api/events"},{"type":"category","label":"Functions","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Lifecycle","href":"/docs/api/functions/lifecycle","docId":"api/functions/lifecycle"},{"type":"link","label":"Player","href":"/docs/api/functions/player","docId":"api/functions/player"},{"type":"link","label":"Queue","href":"/docs/api/functions/queue","docId":"api/functions/queue"}]},{"type":"link","label":"Hooks","href":"/docs/api/hooks","docId":"api/hooks"},{"type":"category","label":"Constants","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"State","href":"/docs/api/constants/state","docId":"api/constants/state"},{"type":"link","label":"Capability","href":"/docs/api/constants/capability","docId":"api/constants/capability"},{"type":"link","label":"Rating","href":"/docs/api/constants/rating","docId":"api/constants/rating"},{"type":"link","label":"Repeat Mode","href":"/docs/api/constants/repeat-mode","docId":"api/constants/repeat-mode"},{"type":"link","label":"Pitch Algorithm (ios-only)","href":"/docs/api/constants/pitch-algorithm","docId":"api/constants/pitch-algorithm"},{"type":"link","label":"App Killed Playback Behavior (android-only)","href":"/docs/api/constants/app-killed-playback-behavior","docId":"api/constants/app-killed-playback-behavior"},{"type":"link","label":"iOS Category (ios-only)","href":"/docs/api/constants/ios-category","docId":"api/constants/ios-category"},{"type":"link","label":"iOS Category Mode (ios-only)","href":"/docs/api/constants/ios-category-mode","docId":"api/constants/ios-category-mode"},{"type":"link","label":"iOS Category Options (ios-only)","href":"/docs/api/constants/ios-category-options","docId":"api/constants/ios-category-options"}]},{"type":"category","label":"Objects","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Track","href":"/docs/api/objects/track","docId":"api/objects/track"},{"type":"link","label":"Feedback","href":"/docs/api/objects/feedback","docId":"api/objects/feedback"},{"type":"link","label":"AndroidOptions","href":"/docs/api/objects/android-options","docId":"api/objects/android-options"},{"type":"link","label":"\u26a0\ufe0f MetadataOptions","href":"/docs/api/objects/metadata-options","docId":"api/objects/metadata-options"},{"type":"link","label":"AudioMetadataReceivedEvent","href":"/docs/api/objects/metadata","docId":"api/objects/metadata"},{"type":"link","label":"PlaybackErrorEvent","href":"/docs/api/objects/playback-error-event","docId":"api/objects/playback-error-event"},{"type":"link","label":"PlaybackState","href":"/docs/api/objects/playback-state","docId":"api/objects/playback-state"},{"type":"link","label":"PlayerOptions","href":"/docs/api/objects/player-options","docId":"api/objects/player-options"},{"type":"link","label":"Progress","href":"/docs/api/objects/progress","docId":"api/objects/progress"},{"type":"link","label":"Resource","href":"/docs/api/objects/resource","docId":"api/objects/resource"},{"type":"link","label":"UpdateOptions","href":"/docs/api/objects/update-options","docId":"api/objects/update-options"}]}]},{"type":"category","label":"Guides","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Offline Playback","href":"/docs/guides/offline-playback","docId":"guides/offline-playback"},{"type":"link","label":"Saving Progress","href":"/docs/guides/saving-progress","docId":"guides/saving-progress"},{"type":"link","label":"Sleeptimers","href":"/docs/guides/sleeptimers","docId":"guides/sleeptimers"},{"type":"link","label":"Multitrack Progress","href":"/docs/guides/multitrack-progress","docId":"guides/multitrack-progress"},{"type":"link","label":"Play Buttons","href":"/docs/guides/play-button","docId":"guides/play-button"},{"type":"link","label":"Amazon FireOS Support","href":"/docs/guides/amazon-fire-support","docId":"guides/amazon-fire-support"}]},{"type":"link","label":"Migrating from v1 to v2","href":"/docs/v2-migration","docId":"v2-migration"},{"type":"link","label":"Migrating from v2 to v3","href":"/docs/v3-migration","docId":"v3-migration"},{"type":"link","label":"Migrating from v3.1.0 to v3.2.0","href":"/docs/v3.1.0-migration","docId":"v3.1.0-migration"},{"type":"link","label":"Migrating from v3.2 to v4","href":"/docs/v4-migration","docId":"v4-migration"},{"type":"link","label":"Troubleshooting","href":"/docs/troubleshooting","docId":"troubleshooting"}]},"docs":{"api/constants/app-killed-playback-behavior":{"id":"api/constants/app-killed-playback-behavior","title":"App Killed Playback Behavior (android-only)","description":"ContinuePlayback (default)","sidebar":"app"},"api/constants/capability":{"id":"api/constants/capability","title":"Capability","description":"All Capability types are made available through the named export Capability:","sidebar":"app"},"api/constants/ios-category":{"id":"api/constants/ios-category","title":"iOS Category (ios-only)","description":"All iOS Category types are made available through the named export IOSCategory:","sidebar":"app"},"api/constants/ios-category-mode":{"id":"api/constants/ios-category-mode","title":"iOS Category Mode (ios-only)","description":"All iOS Category Mode types are made available through the named export IOSCategoryMode:","sidebar":"app"},"api/constants/ios-category-options":{"id":"api/constants/ios-category-options","title":"iOS Category Options (ios-only)","description":"All iOS Category Options types are made available through the named export IOSCategoryOptions:","sidebar":"app"},"api/constants/pitch-algorithm":{"id":"api/constants/pitch-algorithm","title":"Pitch Algorithm (ios-only)","description":"All PitchAlgorithm types are made available through the named export PitchAlgorithm:","sidebar":"app"},"api/constants/rating":{"id":"api/constants/rating","title":"Rating","description":"All RatingType types are made available through the named export RatingType:","sidebar":"app"},"api/constants/repeat-mode":{"id":"api/constants/repeat-mode","title":"Repeat Mode","description":"All RepeatMode types are made available through the named export RepeatMode:","sidebar":"app"},"api/constants/state":{"id":"api/constants/state","title":"State","description":"All State types are made available through the named export State:","sidebar":"app"},"api/events":{"id":"api/events","title":"Events","description":"All event types are made available through the named export Event:","sidebar":"app"},"api/functions/lifecycle":{"id":"api/functions/lifecycle","title":"Lifecycle","description":"setupPlayer(options: PlayerOptions)","sidebar":"app"},"api/functions/player":{"id":"api/functions/player","title":"Player","description":"setupPlayer(options)","sidebar":"app"},"api/functions/queue":{"id":"api/functions/queue","title":"Queue","description":"add(tracks, insertBeforeIndex)","sidebar":"app"},"api/hooks":{"id":"api/hooks","title":"Hooks","description":"React v16.8 introduced hooks. If you are using a version of React Native that is before v0.59.0, your React Native version does not support hooks.","sidebar":"app"},"api/objects/android-options":{"id":"api/objects/android-options","title":"AndroidOptions","description":"Options available for the android player. All options are optional.","sidebar":"app"},"api/objects/feedback":{"id":"api/objects/feedback","title":"Feedback","description":"Controls the rendering of the control center item.","sidebar":"app"},"api/objects/metadata":{"id":"api/objects/metadata","title":"AudioMetadataReceivedEvent","description":"An object representing the timed or chapter metadata received for a track.","sidebar":"app"},"api/objects/metadata-options":{"id":"api/objects/metadata-options","title":"\u26a0\ufe0f MetadataOptions","description":"\u26a0\ufe0f Deprecated in favor of UpdateOptions","sidebar":"app"},"api/objects/playback-error-event":{"id":"api/objects/playback-error-event","title":"PlaybackErrorEvent","description":"An object denoting a playback error encountered during loading or playback of a","sidebar":"app"},"api/objects/playback-state":{"id":"api/objects/playback-state","title":"PlaybackState","description":"An object representing the playback state of the player.","sidebar":"app"},"api/objects/player-options":{"id":"api/objects/player-options","title":"PlayerOptions","description":"All parameters are optional. You also only need to specify the ones you want to update.","sidebar":"app"},"api/objects/progress":{"id":"api/objects/progress","title":"Progress","description":"An object representing the various aspects of the active track.","sidebar":"app"},"api/objects/resource":{"id":"api/objects/resource","title":"Resource","description":"Resource objects are the result of require/import for files.","sidebar":"app"},"api/objects/track":{"id":"api/objects/track","title":"Track","description":"Tracks in the player queue are plain javascript objects as described below.","sidebar":"app"},"api/objects/update-options":{"id":"api/objects/update-options","title":"UpdateOptions","description":"All parameters are optional. You also only need to specify the ones you want to update.","sidebar":"app"},"basics/background-mode":{"id":"basics/background-mode","title":"Background Mode","description":"React Native Track Player supports playing audio while your app is in the","sidebar":"app"},"basics/getting-started":{"id":"basics/getting-started","title":"Getting Started","description":"Starting off","sidebar":"app"},"basics/installation":{"id":"basics/installation","title":"Installation","description":"Stable","sidebar":"app"},"basics/platform-support":{"id":"basics/platform-support","title":"Platform Support","description":"Audio Sources","sidebar":"app"},"basics/playback-service":{"id":"basics/playback-service","title":"Playback Service","description":"The playback service keeps running even when the app is in the background. It will start when the player is set up and will only stop when the player is destroyed. It is a good idea to put any code in there that needs to be directly tied to the player state. For example, if you want to be able to track what is being played for analytics purposes, the playback service would be the place to do so.","sidebar":"app"},"guides/amazon-fire-support":{"id":"guides/amazon-fire-support","title":"Amazon FireOS Support","description":"Support for Android in react-native-track-player is built on top of the ExoPlayer media player library provided by Google. ExoPlayer does not officially support Amazon\'s FireOS fork of Android, because it does not pass Android CTS. ExoPlayer seems to work decently on FireOS 5, but it hardly works at all on FireOS 4.","sidebar":"app"},"guides/multitrack-progress":{"id":"guides/multitrack-progress","title":"Multitrack Progress","description":"If you\'re building an app that allows the playback of more than one Track you\'ll","sidebar":"app"},"guides/offline-playback":{"id":"guides/offline-playback","title":"Offline Playback","description":"There are two general use-cases for offline playback:","sidebar":"app"},"guides/play-button":{"id":"guides/play-button","title":"Play Buttons","description":"UI often needs to display a Play button that changes between three states:","sidebar":"app"},"guides/saving-progress":{"id":"guides/saving-progress","title":"Saving Progress","description":"A common use-case is to store the users progress on a particular Track","sidebar":"app"},"guides/sleeptimers":{"id":"guides/sleeptimers","title":"Sleeptimers","description":"This guide has very similar principles and implementation to","sidebar":"app"},"intro":{"id":"intro","title":"Intro","description":"A fully fledged audio module created for music apps. Provides audio playback, external media controls, background mode and more!","sidebar":"app"},"troubleshooting":{"id":"troubleshooting","title":"Troubleshooting","description":"iOS: (Enable Swift) library not found for -lswiftCoreAudio for architecture x86_64","sidebar":"app"},"v2-migration":{"id":"v2-migration","title":"Migrating from v1 to v2","description":"All queue methods have been updating to work on indexes instead of id\'s. We want this library to support all kinds of apps -- and moving to be index based will allow us to better support applications who have long/endless queues and in the future to allow us to build a performant API around queue management.","sidebar":"app"},"v3-migration":{"id":"v3-migration","title":"Migrating from v2 to v3","description":"Due to how Android handles foreground services, it\'s not possible for us to stop the process manually, as it\'s waiting for the foreground service to come back. With v3 we are introducing the following changes related to this:","sidebar":"app"},"v3.1.0-migration":{"id":"v3.1.0-migration","title":"Migrating from v3.1.0 to v3.2.0","description":"stoppingAppPausesPlayback is deprecated","sidebar":"app"},"v4-migration":{"id":"v4-migration","title":"Migrating from v3.2 to v4","description":"General Additions","sidebar":"app"}}}')}}]); \ No newline at end of file diff --git a/assets/js/d6713ad4.1ad77812.js b/assets/js/d6713ad4.1ad77812.js new file mode 100644 index 000000000..6ead94faa --- /dev/null +++ b/assets/js/d6713ad4.1ad77812.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[8089],{3905:function(e,n,t){t.d(n,{Zo:function(){return l},kt:function(){return m}});var r=t(7294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),u=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},l=function(e){var n=u(e.components);return r.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},p=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),p=u(t),m=o,f=p["".concat(c,".").concat(m)]||p[m]||d[m]||a;return t?r.createElement(f,i(i({ref:n},l),{},{components:t})):r.createElement(f,i({ref:n},l))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=p;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var u=2;u {\n+ async function add(tracks: Track | Track[], insertBeforeIndex?: number): Promise {\n\n- async function remove(tracks: string | string[]): Promise {\n+ async function remove(tracks: number | number[]): Promise {\n\n- async function skip(trackId: string): Promise {\n+ function skip(trackIndex: number): Promise {\n\n- async function updateMetadataForTrack(trackId: string, metadata: TrackMetadataBase): Promise {\n+ async function updateMetadataForTrack(trackIndex: number, metadata: TrackMetadataBase): Promise {\n\n- async function getTrack(trackId: string): Promise {\n+ async function getTrack(trackIndex: number): Promise {\n\n- async function getCurrentTrack(): Promise {\n+ async function getCurrentTrack(): Promise {\n\n// Imports\n\nimport TrackPlayer, {\n- STATE_XXX,\n- CAPABILITY_XXX,\n- PITCH_ALGORITHM_XXX,\n- RATING_XXX,\n+ State,\n+ Capability,\n+ PitchAlgorithm,\n+ RatingType,\n+ Event,\n+ RepeatMode\n} from 'react-native-track-player'\n\n// Hooks\n\n- useTrackPlayerProgress\n+ useProgress\n\n// Event Listeners\n// Refrain from using: TrackPlayer.addEventListener() and instead use the provided hooks\n\n+ usePlaybackState\n+ useTrackPlayerEvents\n+ useProgress\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d8463709.24027de5.js b/assets/js/d8463709.24027de5.js new file mode 100644 index 000000000..78e735255 --- /dev/null +++ b/assets/js/d8463709.24027de5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[810],{3905:function(e,t,n){n.d(t,{Zo:function(){return p},kt:function(){return y}});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),s=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(u.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,u=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=s(n),y=a,f=d["".concat(u,".").concat(y)]||d[y]||c[y]||i;return n?r.createElement(f,o(o({ref:t},p),{},{components:n})):r.createElement(f,o({ref:t},p))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var s=2;s=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=t.createContext({}),d=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):i(i({},n),e)),r},s=function(e){var n=d(e.components);return t.createElement(p.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},c=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),c=d(r),m=o,f=c["".concat(p,".").concat(m)]||c[m]||u[m]||a;return r?t.createElement(f,i(i({ref:n},s),{},{components:r})):t.createElement(f,i({ref:n},s))}));function m(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=c;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var d=2;dapp/build.gradle",id:"edit-appbuildgradle",level:3},{value:"Build Using Variants",id:"build-using-variants",level:3}],c={toc:u};function m(e){var n=e.components,r=(0,o.Z)(e,i);return(0,a.kt)("wrapper",(0,t.Z)({},c,r,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"amazon-fireos-support"},"Amazon FireOS Support"),(0,a.kt)("p",null,"Support for Android in ",(0,a.kt)("inlineCode",{parentName:"p"},"react-native-track-player")," is built on top of the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/google/ExoPlayer"},"ExoPlayer")," media player library provided by Google. ExoPlayer does not officially support Amazon's FireOS fork of Android, because it does not pass ",(0,a.kt)("a",{parentName:"p",href:"https://source.android.com/compatibility/cts"},"Android CTS"),". ExoPlayer seems to work decently on FireOS 5, but it hardly works at all on FireOS 4."),(0,a.kt)("p",null,"Thankfully, ",(0,a.kt)("a",{parentName:"p",href:"https://developer.amazon.com/docs/fire-tv/media-players.html#exoplayer"},"Amazon maintains")," a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/amzn/exoplayer-amazon-port"},"ported version of ExoPlayer")," that can be used as a direct replacement as long as matching versions are used."),(0,a.kt)("h2",{id:"setup"},"Setup"),(0,a.kt)("p",null,"In order to fully support FireOS, you will need to build separate APKs for Google and Amazon. This can be accomplised using gradle flavors."),(0,a.kt)("p",null,"You will need to choose a ExoPlayer version that has been ported by Amazon, and that is close enough to the version that ",(0,a.kt)("inlineCode",{parentName:"p"},"react-native-track-player")," currently uses, in order to compile. In this example we have chosen to use ",(0,a.kt)("inlineCode",{parentName:"p"},"2.9.0"),"."),(0,a.kt)("h3",{id:"edit-appbuildgradle"},"Edit ",(0,a.kt)("inlineCode",{parentName:"h3"},"app/build.gradle")),(0,a.kt)("p",null,"Add ",(0,a.kt)("inlineCode",{parentName:"p"},"productFlavors")," to your build file:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'android {\n flavorDimensions "store"\n productFlavors {\n google {\n dimension "store"\n }\n amazon {\n dimension "store"\n }\n }\n ...\n}\n')),(0,a.kt)("p",null,"Override the exoplayer library, and version, by modifying the dependencies:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"dependencies {\n compile (project(':react-native-track-player')) {\n exclude group: 'com.google.android.exoplayer'\n }\n googleImplementation 'com.google.android.exoplayer:exoplayer-core:2.10.1'\n amazonImplementation 'com.amazon.android:exoplayer-core:2.10.1'\n ...\n}\n")),(0,a.kt)("h3",{id:"build-using-variants"},"Build Using Variants"),(0,a.kt)("p",null,"To make builds using either Google or Amazon libraries, you will need to specify a build variant when you build."),(0,a.kt)("p",null,"Here are some examples of ",(0,a.kt)("inlineCode",{parentName:"p"},"react-native")," commands using the ",(0,a.kt)("inlineCode",{parentName:"p"},"--variant")," parameter that can be added as scripts in ",(0,a.kt)("inlineCode",{parentName:"p"},"package.json"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'"scripts": {\n "android-google": "react-native run-android --variant=googleDebug",\n "android-amazon": "react-native run-android --variant=amazonDebug",\n "android-release-google": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle && react-native run-android --variant=googleRelease",\n "android-release-amazon": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle && react-native run-android --variant=amazonRelease",\n ...\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/df47c164.794ea0be.js b/assets/js/df47c164.794ea0be.js new file mode 100644 index 000000000..7fa94a82e --- /dev/null +++ b/assets/js/df47c164.794ea0be.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[9675],{3905:function(e,t,n){n.d(t,{Zo:function(){return p},kt:function(){return y}});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),s=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(u.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,u=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=s(n),y=a,f=d["".concat(u,".").concat(y)]||d[y]||c[y]||i;return n?r.createElement(f,o(o({ref:t},p),{},{components:n})):r.createElement(f,o({ref:t},p))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var s=2;s=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),s=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(u.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,u=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=s(n),y=a,f=d["".concat(u,".").concat(y)]||d[y]||c[y]||i;return n?r.createElement(f,o(o({ref:t},p),{},{components:n})):r.createElement(f,o({ref:t},p))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var s=2;s=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var o=a.createContext({}),d=function(t){var e=a.useContext(o),n=e;return t&&(n="function"==typeof t?t(e):i(i({},e),t)),n},u=function(t){var e=d(t.components);return a.createElement(o.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},k=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,l=t.originalType,o=t.parentName,u=p(t,["components","mdxType","originalType","parentName"]),k=d(n),c=r,N=k["".concat(o,".").concat(c)]||k[c]||m[c]||l;return n?a.createElement(N,i(i({ref:e},u),{},{components:n})):a.createElement(N,i({ref:e},u))}));function c(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=n.length,i=new Array(l);i[0]=k;var p={};for(var o in e)hasOwnProperty.call(e,o)&&(p[o]=e[o]);p.originalType=t,p.mdxType="string"==typeof t?t:r,i[1]=p;for(var d=2;d=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=p(r),g=o,m=d["".concat(l,".").concat(g)]||d[g]||c[g]||s;return r?n.createElement(m,a(a({ref:t},u),{},{components:r})):n.createElement(m,a({ref:t},u))}));function g(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,a=new Array(s);a[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,a[1]=i;for(var p=2;p;\n setProgress: (id: string, progress: number) => void;\n};\n\nexport const useProgressStateStore = create(\n (set: SetState) => ({\n map: {},\n setProgress: (id: string, progress: number) => set((state) => {\n state.map[id] = progress;\n }),\n })\n);\n")),(0,s.kt)("p",null,"Let's also set up a little helper hook to make it easier to read progress (we'll\nuse this later on):"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-ts"},"// src/hooks/useTrackProgress.ts\nimport { useCallback } from 'react';\nimport { useProgressStateStore } from '../store';\n\nexport const useTrackProgress = (id: string | number): number => {\n return useProgressStateStore(useCallback(state => {\n return state.map[id.toString()] || 0;\n }, [id]));\n};\n")),(0,s.kt)("h4",{id:"2-listen-to-progress-updates"},"2. Listen To Progress Updates"),(0,s.kt)("p",null,"Next we need to set up a listener for progress updates in our\n",(0,s.kt)("a",{parentName:"p",href:"/docs/4.0/basics/playback-service"},"playback service")," and update our zustand store:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-ts"},"// src/services/PlaybackService.ts\nimport TrackPlayer, { Event } from 'react-native-track-player';\nimport { useProgressStateStore } from '../store';\n\n// create a local reference for the `setProgress` function\nconst setProgress = useProgressStateStore.getState().setProgress;\n\nexport const PlaybackService = async function() {\n TrackPlayer.addEventListener(Event.PlaybackProgressUpdated, async ({ position, track }) => {\n // get the track to fetch your unique ID property (if applicable)\n const track = await TrackPlayer.getTrack(track);\n // write progress to the zustand store\n setProgress(track.id, position);\n });\n};\n")),(0,s.kt)("p",null,"\u26a0\ufe0f make sure you've configured your ",(0,s.kt)("inlineCode",{parentName:"p"},"progressUpdateEventInterval"),"\nin the ",(0,s.kt)("inlineCode",{parentName:"p"},"TrackPlayer.updateOptions")," call."),(0,s.kt)("h4",{id:"3-reactively-update-progress"},"3. Reactively Update Progress"),(0,s.kt)("p",null,"Finally, we just need to read from the store whenever we display our track list\nitem:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-ts"},"// src/components/TrackListItem.tsx\nimport type { Track } from 'react-native-track-player';\nimport { useTrackProgress } from '../hooks/useTrackProgress';\n\nexport interface TrackListItemProps {}\n\nexport const TrackListItem: React.FC = (track: Track) => {\n const progress = useTrackProgress(track.id);\n return (\n Progress: {progress}\n );\n};\n")),(0,s.kt)("p",null,"\ud83c\udf8a voil\xe0"))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e0a25ebe.39c52a60.js b/assets/js/e0a25ebe.39c52a60.js new file mode 100644 index 000000000..2789a2879 --- /dev/null +++ b/assets/js/e0a25ebe.39c52a60.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[8985],{3905:function(t,e,n){n.d(e,{Zo:function(){return u},kt:function(){return c}});var a=n(7294);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function i(t){for(var e=1;e=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var o=a.createContext({}),d=function(t){var e=a.useContext(o),n=e;return t&&(n="function"==typeof t?t(e):i(i({},e),t)),n},u=function(t){var e=d(t.components);return a.createElement(o.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},k=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,l=t.originalType,o=t.parentName,u=p(t,["components","mdxType","originalType","parentName"]),k=d(n),c=r,s=k["".concat(o,".").concat(c)]||k[c]||m[c]||l;return n?a.createElement(s,i(i({ref:e},u),{},{components:n})):a.createElement(s,i({ref:e},u))}));function c(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=n.length,i=new Array(l);i[0]=k;var p={};for(var o in e)hasOwnProperty.call(e,o)&&(p[o]=e[o]);p.originalType=t,p.mdxType="string"==typeof t?t:r,i[1]=p;for(var d=2;d=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var o=a.createContext({}),d=function(t){var e=a.useContext(o),n=e;return t&&(n="function"==typeof t?t(e):i(i({},e),t)),n},u=function(t){var e=d(t.components);return a.createElement(o.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},k=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,l=t.originalType,o=t.parentName,u=p(t,["components","mdxType","originalType","parentName"]),k=d(n),c=r,s=k["".concat(o,".").concat(c)]||k[c]||m[c]||l;return n?a.createElement(s,i(i({ref:e},u),{},{components:n})):a.createElement(s,i({ref:e},u))}));function c(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=n.length,i=new Array(l);i[0]=k;var p={};for(var o in e)hasOwnProperty.call(e,o)&&(p[o]=e[o]);p.originalType=t,p.mdxType="string"==typeof t?t:r,i[1]=p;for(var d=2;d=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=s(r),m=a,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,i(i({ref:t},l),{},{components:r})):n.createElement(f,i({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var s=2;s=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=s(r),m=a,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,i(i({ref:t},l),{},{components:r})):n.createElement(f,i({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var s=2;s=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(f,i(i({ref:t},s),{},{components:n})):r.createElement(f,i({ref:t},s))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p.mdxType="string"==typeof e?e:a,i[1]=p;for(var c=2;c=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),o=t;return e&&(o="function"==typeof e?e(t):i(i({},t),e)),o},s=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=p(o),y=r,m=d["".concat(l,".").concat(y)]||d[y]||u[y]||a;return o?n.createElement(m,i(i({ref:t},s),{},{components:o})):n.createElement(m,i({ref:t},s))}));function y(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=o.length,i=new Array(a);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var p=2;pPlayback",id:"playback",level:2},{value:"PlayAndRecord",id:"playandrecord",level:2},{value:"MultiRoute",id:"multiroute",level:2},{value:"Ambient",id:"ambient",level:2},{value:"SoloAmbient",id:"soloambient",level:2},{value:"Record",id:"record",level:2}],d={toc:u};function y(e){var t=e.components,o=(0,r.Z)(e,i);return(0,a.kt)("wrapper",(0,n.Z)({},d,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"ios-category-ios-only"},"iOS Category (ios-only)"),(0,a.kt)("p",null,"All iOS Category types are made available through the named export ",(0,a.kt)("inlineCode",{parentName:"p"},"IOSCategory"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"import { IOSCategory } from 'react-native-track-player';\n")),(0,a.kt)("h2",{id:"playback"},(0,a.kt)("inlineCode",{parentName:"h2"},"Playback")),(0,a.kt)("p",null,"The category for playing recorded music or other sounds that are central to the\nsuccessful use of your app."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616509-playback"},"See the Apple Docs")),(0,a.kt)("h2",{id:"playandrecord"},(0,a.kt)("inlineCode",{parentName:"h2"},"PlayAndRecord")),(0,a.kt)("p",null,"The category for recording (input) and playback (output) of audio, such as for a\nVoice over Internet Protocol (VoIP) app."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616568-playandrecord"},"See the Apple Docs")),(0,a.kt)("h2",{id:"multiroute"},(0,a.kt)("inlineCode",{parentName:"h2"},"MultiRoute")),(0,a.kt)("p",null,"The category for routing distinct streams of audio data to different output\ndevices at the same time."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616484-multiroute"},"See the Apple Docs")," "),(0,a.kt)("h2",{id:"ambient"},(0,a.kt)("inlineCode",{parentName:"h2"},"Ambient")),(0,a.kt)("p",null,"The category for an app in which sound playback is nonprimary \u2014 that is, your\napp also works with the sound turned off."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616560-ambient"},"See the Apple Docs")),(0,a.kt)("h2",{id:"soloambient"},(0,a.kt)("inlineCode",{parentName:"h2"},"SoloAmbient")),(0,a.kt)("p",null,"The default audio session category."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616488-soloambient"},"See the Apple Docs")),(0,a.kt)("h2",{id:"record"},(0,a.kt)("inlineCode",{parentName:"h2"},"Record")),(0,a.kt)("p",null,"The category for recording audio while also silencing playback audio."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616451-record"},"See the Apple Docs")))}y.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[5362],{3905:function(e,t,o){o.d(t,{Zo:function(){return s},kt:function(){return y}});var n=o(7294);function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function i(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var l=n.createContext({}),p=function(e){var t=n.useContext(l),o=t;return e&&(o="function"==typeof e?e(t):i(i({},t),e)),o},s=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=p(o),y=r,m=d["".concat(l,".").concat(y)]||d[y]||u[y]||a;return o?n.createElement(m,i(i({ref:t},s),{},{components:o})):n.createElement(m,i({ref:t},s))}));function y(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=o.length,i=new Array(a);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var p=2;pPlayback",id:"playback",level:2},{value:"PlayAndRecord",id:"playandrecord",level:2},{value:"MultiRoute",id:"multiroute",level:2},{value:"Ambient",id:"ambient",level:2},{value:"SoloAmbient",id:"soloambient",level:2},{value:"Record",id:"record",level:2}],d={toc:u};function y(e){var t=e.components,o=(0,r.Z)(e,i);return(0,a.kt)("wrapper",(0,n.Z)({},d,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"ios-category-ios-only"},"iOS Category (ios-only)"),(0,a.kt)("p",null,"All iOS Category types are made available through the named export ",(0,a.kt)("inlineCode",{parentName:"p"},"IOSCategory"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"import { IOSCategory } from 'react-native-track-player';\n")),(0,a.kt)("h2",{id:"playback"},(0,a.kt)("inlineCode",{parentName:"h2"},"Playback")),(0,a.kt)("p",null,"The category for playing recorded music or other sounds that are central to the\nsuccessful use of your app."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616509-playback"},"See the Apple Docs")),(0,a.kt)("h2",{id:"playandrecord"},(0,a.kt)("inlineCode",{parentName:"h2"},"PlayAndRecord")),(0,a.kt)("p",null,"The category for recording (input) and playback (output) of audio, such as for a\nVoice over Internet Protocol (VoIP) app."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616568-playandrecord"},"See the Apple Docs")),(0,a.kt)("h2",{id:"multiroute"},(0,a.kt)("inlineCode",{parentName:"h2"},"MultiRoute")),(0,a.kt)("p",null,"The category for routing distinct streams of audio data to different output\ndevices at the same time."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616484-multiroute"},"See the Apple Docs")," "),(0,a.kt)("h2",{id:"ambient"},(0,a.kt)("inlineCode",{parentName:"h2"},"Ambient")),(0,a.kt)("p",null,"The category for an app in which sound playback is nonprimary \u2014 that is, your\napp also works with the sound turned off."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616560-ambient"},"See the Apple Docs")),(0,a.kt)("h2",{id:"soloambient"},(0,a.kt)("inlineCode",{parentName:"h2"},"SoloAmbient")),(0,a.kt)("p",null,"The default audio session category."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616488-soloambient"},"See the Apple Docs")),(0,a.kt)("h2",{id:"record"},(0,a.kt)("inlineCode",{parentName:"h2"},"Record")),(0,a.kt)("p",null,"The category for recording audio while also silencing playback audio."),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://developer.apple.com/documentation/avfaudio/avaudiosession/category/1616451-record"},"See the Apple Docs")))}y.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/eb235785.9a5f32b3.js b/assets/js/eb235785.9a5f32b3.js new file mode 100644 index 000000000..4784a431d --- /dev/null +++ b/assets/js/eb235785.9a5f32b3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[764],{3905:function(e,t,r){r.d(t,{Zo:function(){return s},kt:function(){return b}});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=p(r),b=a,y=d["".concat(l,".").concat(b)]||d[b]||u[b]||o;return r?n.createElement(y,i(i({ref:t},s),{},{components:r})):n.createElement(y,i({ref:t},s))}));function b(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var p=2;p=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),d=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=d(e.components);return r.createElement(p.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=d(n),m=a,f=u["".concat(p,".").concat(m)]||u[m]||s[m]||o;return n?r.createElement(f,i(i({ref:t},c),{},{components:n})):r.createElement(f,i({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var d=2;d=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=a.createContext({}),p=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},s=function(e){var t=p(e.components);return a.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=p(n),b=o,k=d["".concat(c,".").concat(b)]||d[b]||u[b]||i;return n?a.createElement(k,r(r({ref:t},s),{},{components:n})):a.createElement(k,r({ref:t},s))}));function b(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,r=new Array(i);r[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:o,r[1]=l;for(var p=2;p\n \n\n')))}b.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ecf4ec08.d5c1d02d.js b/assets/js/ecf4ec08.d5c1d02d.js new file mode 100644 index 000000000..d79a2617a --- /dev/null +++ b/assets/js/ecf4ec08.d5c1d02d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[9034],{3905:function(e,t,n){n.d(t,{Zo:function(){return s},kt:function(){return b}});var a=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=a.createContext({}),p=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},s=function(e){var t=p(e.components);return a.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=p(n),b=o,k=d["".concat(c,".").concat(b)]||d[b]||u[b]||i;return n?a.createElement(k,r(r({ref:t},s),{},{components:n})):a.createElement(k,r({ref:t},s))}));function b(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,r=new Array(i);r[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:o,r[1]=l;for(var p=2;p\n \n\n')))}b.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ef393c84.751e77b0.js b/assets/js/ef393c84.a44b7bb5.js similarity index 61% rename from assets/js/ef393c84.751e77b0.js rename to assets/js/ef393c84.a44b7bb5.js index e594a5698..980e391b9 100644 --- a/assets/js/ef393c84.751e77b0.js +++ b/assets/js/ef393c84.a44b7bb5.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[5684],{3905:function(e,t,r){r.d(t,{Zo:function(){return c},kt:function(){return d}});var n=r(7294);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,c=a(e,["components","mdxType","originalType","parentName"]),m=p(r),d=i,f=m["".concat(l,".").concat(d)]||m[d]||u[d]||o;return r?n.createElement(f,s(s({ref:t},c),{},{components:r})):n.createElement(f,s({ref:t},c))}));function d(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=r.length,s=new Array(o);s[0]=m;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a.mdxType="string"==typeof e?e:i,s[1]=a;for(var p=2;p=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,c=a(e,["components","mdxType","originalType","parentName"]),m=p(r),d=i,f=m["".concat(l,".").concat(d)]||m[d]||u[d]||o;return r?n.createElement(f,s(s({ref:t},c),{},{components:r})):n.createElement(f,s({ref:t},c))}));function d(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=r.length,s=new Array(o);s[0]=m;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a.mdxType="string"==typeof e?e:i,s[1]=a;for(var p=2;p=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(n),k=a,m=d["".concat(l,".").concat(k)]||d[k]||u[k]||o;return n?r.createElement(m,i(i({ref:t},p),{},{components:n})):r.createElement(m,i({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var c=2;cuseTrackPlayerEvents",id:"usetrackplayerevents",level:2},{value:"useProgress",id:"useprogress",level:2},{value:"usePlaybackState",id:"useplaybackstate",level:2},{value:"usePlayWhenReady",id:"useplaywhenready",level:2},{value:"useActiveTrack",id:"useactivetrack",level:2}],d={toc:u};function k(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"hooks"},"Hooks"),(0,o.kt)("p",null,"React v16.8 introduced ",(0,o.kt)("a",{parentName:"p",href:"https://reactjs.org/docs/hooks-intro.html"},"hooks"),". If you are using a version of React Native that is before ",(0,o.kt)("a",{parentName:"p",href:"https://reactnative.dev/blog/2019/03/12/releasing-react-native-059"},"v0.59.0"),", your React Native version does not support hooks."),(0,o.kt)("h2",{id:"usetrackplayerevents"},(0,o.kt)("inlineCode",{parentName:"h2"},"useTrackPlayerEvents")),(0,o.kt)("p",null,"Register an event listener for one or more of the ",(0,o.kt)("a",{parentName:"p",href:"/docs/4.0/api/events"},"events")," emitted by the TrackPlayer. The subscription is removed when the component unmounts."),(0,o.kt)("p",null,"Check out the ",(0,o.kt)("a",{parentName:"p",href:"/docs/4.0/api/events"},"events section")," for a full list of supported events."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { useTrackPlayerEvents, Event, State } from 'react-native-track-player';\n\n// Subscribing to the following events inside MyComponent\nconst events = [\n Event.PlaybackState,\n Event.PlaybackError,\n];\n\nconst MyComponent = () => {\n const [playerState, setPlayerState] = useState(null)\n\n useTrackPlayerEvents(events, (event) => {\n if (event.type === Event.PlaybackError) {\n console.warn('An error occured while playing the current track.');\n }\n if (event.type === Event.PlaybackState) {\n setPlayerState(event.state);\n }\n });\n\n const isPlaying = playerState === State.Playing;\n\n return (\n \n The TrackPlayer is {isPlaying ? 'playing' : 'not playing'}\n \n );\n};\n")),(0,o.kt)("h2",{id:"useprogress"},(0,o.kt)("inlineCode",{parentName:"h2"},"useProgress")),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"State"),(0,o.kt)("th",{parentName:"tr",align:null},"Type"),(0,o.kt)("th",{parentName:"tr",align:null},"Description"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"position"),(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"number")),(0,o.kt)("td",{parentName:"tr",align:null},"The current position in seconds")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"buffered"),(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"number")),(0,o.kt)("td",{parentName:"tr",align:null},"The buffered position in seconds")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"duration"),(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"number")),(0,o.kt)("td",{parentName:"tr",align:null},"The duration in seconds")))),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"useProgress")," accepts an interval to set the rate (in miliseconds) to poll the track player's progress. The default value is ",(0,o.kt)("inlineCode",{parentName:"p"},"1000")," or every second."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import React from 'react';\nimport { Text, View } from 'react-native';\nimport { useProgress } from 'react-native-track-player';\n\nconst MyComponent = () => {\n const { position, buffered, duration } = useProgress()\n\n return (\n \n Track progress: {position} seconds out of {duration} total\n Buffered progress: {buffered} seconds buffered out of {duration} total\n \n )\n}\n")),(0,o.kt)("h2",{id:"useplaybackstate"},(0,o.kt)("inlineCode",{parentName:"h2"},"usePlaybackState")),(0,o.kt)("p",null,"A hook which returns the up to date state of ",(0,o.kt)("a",{parentName:"p",href:"/docs/4.0/api/functions/player#getplaybackstate"},(0,o.kt)("inlineCode",{parentName:"a"},"getPlaybackState()")),".\nThe hook will initially return ",(0,o.kt)("inlineCode",{parentName:"p"},"{ state: undefined }")," while it is awaiting the\ninitial state of the player."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-tsx"},"import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { usePlaybackState, State } from 'react-native-track-player';\n\nconst MyComponent = () => {\n const playerState = usePlaybackState();\n const isPlaying = playerState === State.Playing;\n\n return (\n \n The TrackPlayer is {isPlaying ? 'playing' : 'not playing'}\n \n );\n};\n")),(0,o.kt)("h2",{id:"useplaywhenready"},(0,o.kt)("inlineCode",{parentName:"h2"},"usePlayWhenReady")),(0,o.kt)("p",null,"A hook which returns the up to date state of ",(0,o.kt)("inlineCode",{parentName:"p"},"TrackPlayer.getPlayWhenReady()"),"."),(0,o.kt)("h2",{id:"useactivetrack"},(0,o.kt)("inlineCode",{parentName:"h2"},"useActiveTrack")),(0,o.kt)("p",null,"A hook which keeps track of the currently active track using\n",(0,o.kt)("inlineCode",{parentName:"p"},"TrackPlayer.getActiveTrack()")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Event.PlaybackActiveTrackChanged"),"."))}k.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f03452c8.10847390.js b/assets/js/f03452c8.ffd875b5.js similarity index 58% rename from assets/js/f03452c8.10847390.js rename to assets/js/f03452c8.ffd875b5.js index 015ffc5d3..4957694d4 100644 --- a/assets/js/f03452c8.10847390.js +++ b/assets/js/f03452c8.ffd875b5.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1055],{3905:function(e,t,n){n.d(t,{Zo:function(){return l},kt:function(){return m}});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=s(n),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(f,a(a({ref:t},l),{},{components:n})):r.createElement(f,a({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p.mdxType="string"==typeof e?e:o,a[1]=p;for(var s=2;sstoppingAppPausesPlayback is deprecated",id:"stoppingapppausesplayback-is-deprecated",level:3},{value:"compileSdkVersion 33",id:"compilesdkversion-33",level:3}],d={toc:u};function m(e){var t=e.components,n=(0,o.Z)(e,a);return(0,i.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"migrating-from-v310-to-v320"},"Migrating from v3.1.0 to v3.2.0"),(0,i.kt)("h3",{id:"stoppingapppausesplayback-is-deprecated"},(0,i.kt)("inlineCode",{parentName:"h3"},"stoppingAppPausesPlayback")," is deprecated"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-diff"},"await TrackPlayer.updateOptions({\n+ android: {\n+ appKilledPlaybackBehavior: AppKilledPlaybackBehavior.ContinuePlayback\n+ },\n // This flag is now deprecated. Please use the above to define playback mode.\n- stoppingAppPausesPlayback: true,\n}\n")),(0,i.kt)("h3",{id:"compilesdkversion-33"},(0,i.kt)("inlineCode",{parentName:"h3"},"compileSdkVersion")," 33"),(0,i.kt)("p",null,"The upgrade to ",(0,i.kt)("inlineCode",{parentName:"p"},"v3.2.0")," ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/doublesymmetry/react-native-track-player/issues/1767#issuecomment-1267156549"},"requires a minimum ",(0,i.kt)("inlineCode",{parentName:"a"},"compileSdkVersion")," of ",(0,i.kt)("inlineCode",{parentName:"a"},"33")),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-diff"},"- compileSdkVersion = 31\n+ compileSdkVersion = 33\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1055],{3905:function(e,t,n){n.d(t,{Zo:function(){return l},kt:function(){return m}});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=s(n),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(f,a(a({ref:t},l),{},{components:n})):r.createElement(f,a({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p.mdxType="string"==typeof e?e:o,a[1]=p;for(var s=2;sstoppingAppPausesPlayback is deprecated",id:"stoppingapppausesplayback-is-deprecated",level:3},{value:"compileSdkVersion 33",id:"compilesdkversion-33",level:3}],d={toc:u};function m(e){var t=e.components,n=(0,o.Z)(e,a);return(0,i.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"migrating-from-v310-to-v320"},"Migrating from v3.1.0 to v3.2.0"),(0,i.kt)("h3",{id:"stoppingapppausesplayback-is-deprecated"},(0,i.kt)("inlineCode",{parentName:"h3"},"stoppingAppPausesPlayback")," is deprecated"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-diff"},"await TrackPlayer.updateOptions({\n+ android: {\n+ appKilledPlaybackBehavior: AppKilledPlaybackBehavior.ContinuePlayback\n+ },\n // This flag is now deprecated. Please use the above to define playback mode.\n- stoppingAppPausesPlayback: true,\n}\n")),(0,i.kt)("h3",{id:"compilesdkversion-33"},(0,i.kt)("inlineCode",{parentName:"h3"},"compileSdkVersion")," 33"),(0,i.kt)("p",null,"The upgrade to ",(0,i.kt)("inlineCode",{parentName:"p"},"v3.2.0")," ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/doublesymmetry/react-native-track-player/issues/1767#issuecomment-1267156549"},"requires a minimum ",(0,i.kt)("inlineCode",{parentName:"a"},"compileSdkVersion")," of ",(0,i.kt)("inlineCode",{parentName:"a"},"33")),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-diff"},"- compileSdkVersion = 31\n+ compileSdkVersion = 33\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f0536058.466a776b.js b/assets/js/f0536058.466a776b.js new file mode 100644 index 000000000..2cd01f5ef --- /dev/null +++ b/assets/js/f0536058.466a776b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[5015],{3905:function(e,t,n){n.d(t,{Zo:function(){return s},kt:function(){return y}});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=p(n),y=r,f=d["".concat(l,".").concat(y)]||d[y]||u[y]||o;return n?a.createElement(f,i(i({ref:t},s),{},{components:n})):a.createElement(f,i({ref:t},s))}));function y(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var p=2;pContinuePlayback (default)",id:"continueplayback-default",level:2},{value:"PausePlayback",id:"pauseplayback",level:2},{value:"StopPlaybackAndRemoveNotification",id:"stopplaybackandremovenotification",level:2}],d={toc:u};function y(e){var t=e.components,n=(0,r.Z)(e,i);return(0,o.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"app-killed-playback-behavior-android-only"},"App Killed Playback Behavior (android-only)"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"import { AppKilledPlaybackBehavior } from 'react-native-track-player';\n")),(0,o.kt)("h2",{id:"continueplayback-default"},(0,o.kt)("inlineCode",{parentName:"h2"},"ContinuePlayback")," (default)"),(0,o.kt)("p",null,"This option will continue playing audio in the background when the app is\nremoved from recents. The notification remains. This is the default."),(0,o.kt)("h2",{id:"pauseplayback"},(0,o.kt)("inlineCode",{parentName:"h2"},"PausePlayback")),(0,o.kt)("p",null,"This option will pause playing audio in the background when the app is removed\nfrom recents. The notification remains and can be used to resume playback."),(0,o.kt)("h2",{id:"stopplaybackandremovenotification"},(0,o.kt)("inlineCode",{parentName:"h2"},"StopPlaybackAndRemoveNotification")),(0,o.kt)("p",null,"This option will stop playing audio in the background when the app is removed\nfrom recents. The notification is removed and can't be used to resume playback.\nUsers would need to open the app again to start playing audio."))}y.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f0a2a361.48cd9c41.js b/assets/js/f0a2a361.48cd9c41.js new file mode 100644 index 000000000..20c450e18 --- /dev/null +++ b/assets/js/f0a2a361.48cd9c41.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[3754],{3905:function(e,t,r){r.d(t,{Zo:function(){return p},kt:function(){return d}});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),m=c(r),d=a,f=m["".concat(s,".").concat(d)]||m[d]||u[d]||o;return r?n.createElement(f,i(i({ref:t},p),{},{components:r})):n.createElement(f,i({ref:t},p))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var c=2;c {\n await TrackPlayer.setupPlayer({});\n\n await TrackPlayer.add({\n url: require('track.mp3'),\n title: 'Track Title',\n artist: 'Track Artist',\n artwork: require('track.png')\n });\n\n TrackPlayer.setRepeatMode(RepeatMode.Queue);\n};\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f0a2a361.b63133c5.js b/assets/js/f0a2a361.b63133c5.js deleted file mode 100644 index 3c9dd3194..000000000 --- a/assets/js/f0a2a361.b63133c5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[3754],{3905:function(e,t,r){r.d(t,{Zo:function(){return p},kt:function(){return d}});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),m=c(r),d=a,f=m["".concat(s,".").concat(d)]||m[d]||u[d]||o;return r?n.createElement(f,i(i({ref:t},p),{},{components:r})):n.createElement(f,i({ref:t},p))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var c=2;c {\n await TrackPlayer.setupPlayer({});\n\n await TrackPlayer.add({\n url: require('track.mp3'),\n title: 'Track Title',\n artist: 'Track Artist',\n artwork: require('track.png')\n });\n\n TrackPlayer.setRepeatMode(RepeatMode.Queue);\n};\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f1a88448.69586857.js b/assets/js/f1a88448.69586857.js new file mode 100644 index 000000000..bceeb6d3c --- /dev/null +++ b/assets/js/f1a88448.69586857.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[355],{3905:function(e,t,n){n.d(t,{Zo:function(){return l},kt:function(){return m}});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=s(n),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(f,a(a({ref:t},l),{},{components:n})):r.createElement(f,a({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p.mdxType="string"==typeof e?e:o,a[1]=p;for(var s=2;sstoppingAppPausesPlayback is deprecated",id:"stoppingapppausesplayback-is-deprecated",level:3},{value:"compileSdkVersion 33",id:"compilesdkversion-33",level:3}],d={toc:u};function m(e){var t=e.components,n=(0,o.Z)(e,a);return(0,i.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"migrating-from-v310-to-v320"},"Migrating from v3.1.0 to v3.2.0"),(0,i.kt)("h3",{id:"stoppingapppausesplayback-is-deprecated"},(0,i.kt)("inlineCode",{parentName:"h3"},"stoppingAppPausesPlayback")," is deprecated"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-diff"},"await TrackPlayer.updateOptions({\n+ android: {\n+ appKilledPlaybackBehavior: AppKilledPlaybackBehavior.ContinuePlayback\n+ },\n // This flag is now deprecated. Please use the above to define playback mode.\n- stoppingAppPausesPlayback: true,\n}\n")),(0,i.kt)("h3",{id:"compilesdkversion-33"},(0,i.kt)("inlineCode",{parentName:"h3"},"compileSdkVersion")," 33"),(0,i.kt)("p",null,"The upgrade to ",(0,i.kt)("inlineCode",{parentName:"p"},"v3.2.0")," ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/doublesymmetry/react-native-track-player/issues/1767#issuecomment-1267156549"},"requires a minimum ",(0,i.kt)("inlineCode",{parentName:"a"},"compileSdkVersion")," of ",(0,i.kt)("inlineCode",{parentName:"a"},"33")),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-diff"},"- compileSdkVersion = 31\n+ compileSdkVersion = 33\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f7993752.7681587a.js b/assets/js/f7993752.7681587a.js new file mode 100644 index 000000000..c5531f9af --- /dev/null +++ b/assets/js/f7993752.7681587a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[3392],{3905:function(e,t,n){n.d(t,{Zo:function(){return p},kt:function(){return m}});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),d=l(n),m=a,y=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(y,i(i({ref:t},p),{},{components:n})):r.createElement(y,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l PlaybackService);\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"// src/services/PlaybackService.ts\nimport { Event } from 'react-native-track-player';\n\nexport const PlaybackService = async function() {\n\n TrackPlayer.addEventListener(Event.RemotePlay, () => TrackPlayer.play());\n\n TrackPlayer.addEventListener(Event.RemotePause, () => TrackPlayer.pause());\n\n // ...\n\n};\n")),(0,o.kt)("h2",{id:"custom-media-controls-notification-id--name"},"Custom Media Controls Notification id & name"),(0,o.kt)("p",null,"react-native-track-player is using media controls.\nAs a result, it creates a notification channel."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"More information read here: ",(0,o.kt)("a",{parentName:"li",href:"https://developer.android.com/media/implement/surfaces/mobile"},"https://developer.android.com/media/implement/surfaces/mobile"))),(0,o.kt)("p",null,"To customize it, put the example below inside your project folder."),(0,o.kt)("h2",{id:"example-1"},"Example"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-xml"},'\x3c!-- YOUR_PROJECT_DIR/android/app/src/main/res/values/strings.xml --\x3e\n\n \x3c!-- rtnp channel id --\x3e\n temporary_channel\n \x3c!-- rtnp channel name --\x3e\n temporary_channel\n \x3c!-- playback_channel_name used by KotlinAudio in rntp --\x3e\n Music Player\n\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f87dac3c.1fbcc98d.js b/assets/js/f87dac3c.1fbcc98d.js deleted file mode 100644 index de94822c9..000000000 --- a/assets/js/f87dac3c.1fbcc98d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[9450],{3905:function(t,e,n){n.d(e,{Zo:function(){return u},kt:function(){return m}});var a=n(7294);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function l(t){for(var e=1;e=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var p=a.createContext({}),d=function(t){var e=a.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):l(l({},e),t)),n},u=function(t){var e=d(t.components);return a.createElement(p.Provider,{value:e},t.children)},s={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},c=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,i=t.originalType,p=t.parentName,u=o(t,["components","mdxType","originalType","parentName"]),c=d(n),m=r,k=c["".concat(p,".").concat(m)]||c[m]||s[m]||i;return n?a.createElement(k,l(l({ref:e},u),{},{components:n})):a.createElement(k,l({ref:e},u))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var i=n.length,l=new Array(i);l[0]=c;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:r,l[1]=o;for(var d=2;dsetupPlayer(options: PlayerOptions)",id:"setupplayeroptions-playeroptions",level:2},{value:"registerPlaybackService(serviceProvider)",id:"registerplaybackserviceserviceprovider",level:2},{value:"useTrackPlayerEvents(events: Event[], handler: Handler)",id:"usetrackplayereventsevents-event-handler-handler",level:2}],c={toc:s};function m(t){var e=t.components,n=(0,r.Z)(t,l);return(0,i.kt)("wrapper",(0,a.Z)({},c,n,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"lifecycle"},"Lifecycle"),(0,i.kt)("h2",{id:"setupplayeroptions-playeroptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"setupPlayer(options: PlayerOptions)")),(0,i.kt)("p",null,"Initializes the player with the specified options. These options do not apply to all platforms, see chart below."),(0,i.kt)("p",null,"These options are different than the ones set using ",(0,i.kt)("inlineCode",{parentName:"p"},"updateOptions()"),". Options other than those listed below will not be applied."),(0,i.kt)("p",null,"You should always call this function (even without any options set) before using the player to make sure everything is initialized. Do not call this more than once in the lifetime of your app."),(0,i.kt)("p",null,"Note that on Android this method must only be called while the app is in the foreground, otherwise it will throw an error with code ",(0,i.kt)("inlineCode",{parentName:"p"},"'android_cannot_setup_player_in_background'"),". In this case you can wait for the app to be in the foreground and try again."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"),(0,i.kt)("th",{parentName:"tr",align:null},"Default"),(0,i.kt)("th",{parentName:"tr",align:"center"},"Android"),(0,i.kt)("th",{parentName:"tr",align:"center"},"iOS"),(0,i.kt)("th",{parentName:"tr",align:"center"},"Windows"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"PlayerOptions")),(0,i.kt)("td",{parentName:"tr",align:null},"The options"),(0,i.kt)("td",{parentName:"tr",align:null}),(0,i.kt)("td",{parentName:"tr",align:"center"}),(0,i.kt)("td",{parentName:"tr",align:"center"}),(0,i.kt)("td",{parentName:"tr",align:"center"})),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.minBuffer"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Minimum time in seconds that needs to be buffered"),(0,i.kt)("td",{parentName:"tr",align:null},"15 (android), automatic (ios)"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.maxBuffer"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Maximum time in seconds that needs to be buffered"),(0,i.kt)("td",{parentName:"tr",align:null},"50"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.playBuffer"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Minimum time in seconds that needs to be buffered to start playing"),(0,i.kt)("td",{parentName:"tr",align:null},"2.5"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.backBuffer"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Time in seconds that should be kept in the buffer behind the current playhead time."),(0,i.kt)("td",{parentName:"tr",align:null},"0"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.maxCacheSize"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Maximum cache size in kilobytes"),(0,i.kt)("td",{parentName:"tr",align:null},"0"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.androidAudioContentType"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"AndroidAudioContentType")),(0,i.kt)("td",{parentName:"tr",align:null},"The audio content type indicates to the android system how you intend to use audio in your app."),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"AndroidAudioContentType.Music")),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.iosCategory"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"IOSCategory")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("a",{parentName:"td",href:"https://developer.apple.com/documentation/avfoundation/avaudiosession/1616615-category"},"AVAudioSession.Category")," for iOS. Sets on ",(0,i.kt)("inlineCode",{parentName:"td"},"play()")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"IOSCategory.Playback")),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.iosCategoryOptions"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"IOSCategoryOptions[]")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("a",{parentName:"td",href:"https://developer.apple.com/documentation/avfoundation/avaudiosession/1616503-categoryoptions"},"AVAudioSession.CategoryOptions")," for iOS. Sets on ",(0,i.kt)("inlineCode",{parentName:"td"},"play()")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"[]")),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.iosCategoryMode"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"IOSCategoryMode")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("a",{parentName:"td",href:"https://developer.apple.com/documentation/avfoundation/avaudiosession/1616508-mode"},"AVAudioSession.Mode")," for iOS. Sets on ",(0,i.kt)("inlineCode",{parentName:"td"},"play()")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"default")),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.autoHandleInterruptions"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"boolean")),(0,i.kt)("td",{parentName:"tr",align:null},"Indicates whether the player should automatically handle audio interruptions."),(0,i.kt)("td",{parentName:"tr",align:null},"false"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.autoUpdateMetadata"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"boolean")),(0,i.kt)("td",{parentName:"tr",align:null},"Indicates whether the player should automatically update now playing metadata data in control center / notification."),(0,i.kt)("td",{parentName:"tr",align:null},"true"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")))),(0,i.kt)("h2",{id:"registerplaybackserviceserviceprovider"},(0,i.kt)("inlineCode",{parentName:"h2"},"registerPlaybackService(serviceProvider)")),(0,i.kt)("p",null,"Register the playback service. The service will run as long as the player runs."),(0,i.kt)("p",null,"This function should only be called once, and should be registered right after registering your React application with ",(0,i.kt)("inlineCode",{parentName:"p"},"AppRegistry"),"."),(0,i.kt)("p",null,"You should use the playback service to register the event handlers that must be directly tied to the player, as the playback service might keep running when the app is in background."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"serviceProvider"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"function")),(0,i.kt)("td",{parentName:"tr",align:null},"The function that must return an async service function.")))),(0,i.kt)("h2",{id:"usetrackplayereventsevents-event-handler-handler"},(0,i.kt)("inlineCode",{parentName:"h2"},"useTrackPlayerEvents(events: Event[], handler: Handler)")),(0,i.kt)("p",null,"Hook that fires on the specified events."),(0,i.kt)("p",null,"You can find a list of events in the ",(0,i.kt)("a",{parentName:"p",href:"/docs/api/events#player"},"events section"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f87dac3c.c8a7fef7.js b/assets/js/f87dac3c.c8a7fef7.js new file mode 100644 index 000000000..09ebf4c22 --- /dev/null +++ b/assets/js/f87dac3c.c8a7fef7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[9450],{3905:function(t,e,n){n.d(e,{Zo:function(){return u},kt:function(){return m}});var a=n(7294);function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function l(t){for(var e=1;e=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}var p=a.createContext({}),d=function(t){var e=a.useContext(p),n=e;return t&&(n="function"==typeof t?t(e):l(l({},e),t)),n},u=function(t){var e=d(t.components);return a.createElement(p.Provider,{value:e},t.children)},s={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},c=a.forwardRef((function(t,e){var n=t.components,r=t.mdxType,i=t.originalType,p=t.parentName,u=o(t,["components","mdxType","originalType","parentName"]),c=d(n),m=r,k=c["".concat(p,".").concat(m)]||c[m]||s[m]||i;return n?a.createElement(k,l(l({ref:e},u),{},{components:n})):a.createElement(k,l({ref:e},u))}));function m(t,e){var n=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var i=n.length,l=new Array(i);l[0]=c;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:r,l[1]=o;for(var d=2;dsetupPlayer(options: PlayerOptions)",id:"setupplayeroptions-playeroptions",level:2},{value:"registerPlaybackService(serviceProvider)",id:"registerplaybackserviceserviceprovider",level:2},{value:"useTrackPlayerEvents(events: Event[], handler: Handler)",id:"usetrackplayereventsevents-event-handler-handler",level:2}],c={toc:s};function m(t){var e=t.components,n=(0,r.Z)(t,l);return(0,i.kt)("wrapper",(0,a.Z)({},c,n,{components:e,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"lifecycle"},"Lifecycle"),(0,i.kt)("h2",{id:"setupplayeroptions-playeroptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"setupPlayer(options: PlayerOptions)")),(0,i.kt)("p",null,"Initializes the player with the specified options. These options do not apply to all platforms, see chart below."),(0,i.kt)("p",null,"These options are different than the ones set using ",(0,i.kt)("inlineCode",{parentName:"p"},"updateOptions()"),". Options other than those listed below will not be applied."),(0,i.kt)("p",null,"You should always call this function (even without any options set) before using the player to make sure everything is initialized. Do not call this more than once in the lifetime of your app."),(0,i.kt)("p",null,"Note that on Android this method must only be called while the app is in the foreground, otherwise it will throw an error with code ",(0,i.kt)("inlineCode",{parentName:"p"},"'android_cannot_setup_player_in_background'"),". In this case you can wait for the app to be in the foreground and try again."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns:")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"),(0,i.kt)("th",{parentName:"tr",align:null},"Default"),(0,i.kt)("th",{parentName:"tr",align:"center"},"Android"),(0,i.kt)("th",{parentName:"tr",align:"center"},"iOS"),(0,i.kt)("th",{parentName:"tr",align:"center"},"Windows"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"PlayerOptions")),(0,i.kt)("td",{parentName:"tr",align:null},"The options"),(0,i.kt)("td",{parentName:"tr",align:null}),(0,i.kt)("td",{parentName:"tr",align:"center"}),(0,i.kt)("td",{parentName:"tr",align:"center"}),(0,i.kt)("td",{parentName:"tr",align:"center"})),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.minBuffer"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Minimum time in seconds that needs to be buffered"),(0,i.kt)("td",{parentName:"tr",align:null},"15 (android), automatic (ios)"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.maxBuffer"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Maximum time in seconds that needs to be buffered"),(0,i.kt)("td",{parentName:"tr",align:null},"50"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.playBuffer"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Minimum time in seconds that needs to be buffered to start playing"),(0,i.kt)("td",{parentName:"tr",align:null},"2.5"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.backBuffer"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Time in seconds that should be kept in the buffer behind the current playhead time."),(0,i.kt)("td",{parentName:"tr",align:null},"0"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.maxCacheSize"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"number")),(0,i.kt)("td",{parentName:"tr",align:null},"Maximum cache size in kilobytes"),(0,i.kt)("td",{parentName:"tr",align:null},"0"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.androidAudioContentType"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"AndroidAudioContentType")),(0,i.kt)("td",{parentName:"tr",align:null},"The audio content type indicates to the android system how you intend to use audio in your app."),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"AndroidAudioContentType.Music")),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.iosCategory"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"IOSCategory")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("a",{parentName:"td",href:"https://developer.apple.com/documentation/avfoundation/avaudiosession/1616615-category"},"AVAudioSession.Category")," for iOS. Sets on ",(0,i.kt)("inlineCode",{parentName:"td"},"play()")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"IOSCategory.Playback")),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.iosCategoryOptions"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"IOSCategoryOptions[]")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("a",{parentName:"td",href:"https://developer.apple.com/documentation/avfoundation/avaudiosession/1616503-categoryoptions"},"AVAudioSession.CategoryOptions")," for iOS. Sets on ",(0,i.kt)("inlineCode",{parentName:"td"},"play()")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"[]")),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.iosCategoryMode"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"IOSCategoryMode")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("a",{parentName:"td",href:"https://developer.apple.com/documentation/avfoundation/avaudiosession/1616508-mode"},"AVAudioSession.Mode")," for iOS. Sets on ",(0,i.kt)("inlineCode",{parentName:"td"},"play()")),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"default")),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.autoHandleInterruptions"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"boolean")),(0,i.kt)("td",{parentName:"tr",align:null},"Indicates whether the player should automatically handle audio interruptions."),(0,i.kt)("td",{parentName:"tr",align:null},"false"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"options.autoUpdateMetadata"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"boolean")),(0,i.kt)("td",{parentName:"tr",align:null},"Indicates whether the player should automatically update now playing metadata data in control center / notification."),(0,i.kt)("td",{parentName:"tr",align:null},"true"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u2705"),(0,i.kt)("td",{parentName:"tr",align:"center"},"\u274c")))),(0,i.kt)("h2",{id:"registerplaybackserviceserviceprovider"},(0,i.kt)("inlineCode",{parentName:"h2"},"registerPlaybackService(serviceProvider)")),(0,i.kt)("p",null,"Register the playback service. The service will run as long as the player runs."),(0,i.kt)("p",null,"This function should only be called once, and should be registered right after registering your React application with ",(0,i.kt)("inlineCode",{parentName:"p"},"AppRegistry"),"."),(0,i.kt)("p",null,"You should use the playback service to register the event handlers that must be directly tied to the player, as the playback service might keep running when the app is in background."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Param"),(0,i.kt)("th",{parentName:"tr",align:null},"Type"),(0,i.kt)("th",{parentName:"tr",align:null},"Description"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"serviceProvider"),(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"function")),(0,i.kt)("td",{parentName:"tr",align:null},"The function that must return an async service function.")))),(0,i.kt)("h2",{id:"usetrackplayereventsevents-event-handler-handler"},(0,i.kt)("inlineCode",{parentName:"h2"},"useTrackPlayerEvents(events: Event[], handler: Handler)")),(0,i.kt)("p",null,"Hook that fires on the specified events."),(0,i.kt)("p",null,"You can find a list of events in the ",(0,i.kt)("a",{parentName:"p",href:"/docs/4.0/api/events#player"},"events section"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/fe98b244.c9805ae7.js b/assets/js/fe98b244.4310abfa.js similarity index 60% rename from assets/js/fe98b244.c9805ae7.js rename to assets/js/fe98b244.4310abfa.js index 61ad9dd75..6928adda4 100644 --- a/assets/js/fe98b244.c9805ae7.js +++ b/assets/js/fe98b244.4310abfa.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[2090],{3905:function(t,e,n){n.d(e,{Zo:function(){return s},kt:function(){return d}});var r=n(7294);function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e=0||(a[n]=t[n]);return a}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}var c=r.createContext({}),p=function(t){var e=r.useContext(c),n=e;return t&&(n="function"==typeof t?t(e):i(i({},e),t)),n},s=function(t){var e=p(t.components);return r.createElement(c.Provider,{value:e},t.children)},u={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},m=r.forwardRef((function(t,e){var n=t.components,a=t.mdxType,o=t.originalType,c=t.parentName,s=l(t,["components","mdxType","originalType","parentName"]),m=p(n),d=a,h=m["".concat(c,".").concat(d)]||m[d]||u[d]||o;return n?r.createElement(h,i(i({ref:e},s),{},{components:n})):r.createElement(h,i({ref:e},s))}));function d(t,e){var n=arguments,a=e&&e.mdxType;if("string"==typeof t||a){var o=n.length,i=new Array(o);i[0]=m;var l={};for(var c in e)hasOwnProperty.call(e,c)&&(l[c]=e[c]);l.originalType=t,l.mdxType="string"==typeof t?t:a,i[1]=l;for(var p=2;p=0||(a[n]=t[n]);return a}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n])}return a}var c=r.createContext({}),p=function(t){var e=r.useContext(c),n=e;return t&&(n="function"==typeof t?t(e):i(i({},e),t)),n},s=function(t){var e=p(t.components);return r.createElement(c.Provider,{value:e},t.children)},u={inlineCode:"code",wrapper:function(t){var e=t.children;return r.createElement(r.Fragment,{},e)}},m=r.forwardRef((function(t,e){var n=t.components,a=t.mdxType,o=t.originalType,c=t.parentName,s=l(t,["components","mdxType","originalType","parentName"]),m=p(n),d=a,h=m["".concat(c,".").concat(d)]||m[d]||u[d]||o;return n?r.createElement(h,i(i({ref:e},s),{},{components:n})):r.createElement(h,i({ref:e},s))}));function d(t,e){var n=arguments,a=e&&e.mdxType;if("string"==typeof t||a){var o=n.length,i=new Array(o);i[0]=m;var l={};for(var c in e)hasOwnProperty.call(e,c)&&(l[c]=e[c]);l.originalType=t,l.mdxType="string"==typeof t?t:a,i[1]=l;for(var p=2;p\n

Your Docusaurus site did not load properly.

\n

A very common reason is a wrong site baseUrl configuration.

\n

Current configured baseUrl = '+e+" "+("/"===e?" (default value)":"")+'

\n

We suggest trying baseUrl =

\n\n'}(e)).replace(/0)&&(F.current.unobserve(t),F.current.disconnect(),n())}))})),F.current.observe(t))},to:N},h&&{isActive:y,activeClassName:v}))}var h=a.forwardRef(m)},5999:function(e,t,n){"use strict";n.d(t,{Z:function(){return u},I:function(){return l}});var r=n(7294),o=/\{\w+\}/g,a="{}";function i(e,t){var n=[],i=e.replace(o,(function(e){var o=e.substring(1,e.length-1),i=null==t?void 0:t[o];if(void 0!==i){var s=(0,r.isValidElement)(i)?i:String(i);return n.push(s),a}return e}));return 0===n.length?e:n.every((function(e){return"string"==typeof e}))?i.split(a).reduce((function(e,t,r){var o;return e.concat(t).concat(null!=(o=n[r])?o:"")}),""):i.split(a).reduce((function(e,t,o){return[].concat(e,[r.createElement(r.Fragment,{key:o},t,n[o])])}),[])}var s=n(7529);function c(e){var t,n,r=e.id,o=e.message;if(void 0===r&&void 0===o)throw new Error("Docusaurus translation declarations must have at least a translation id or a default translation message");return null!=(t=null!=(n=s[null!=r?r:o])?n:o)?t:r}function l(e,t){return i(c({message:e.message,id:e.id}),t)}function u(e){var t=e.children,n=e.id,o=e.values;if(t&&"string"!=typeof t)throw console.warn("Illegal children",t),new Error("The Docusaurus component only accept simple string values");var a=c({message:t,id:n});return r.createElement(r.Fragment,null,i(a,o))}},9935:function(e,t,n){"use strict";n.d(t,{m:function(){return r}});var r="default"},3919:function(e,t,n){"use strict";function r(e){return!0===/^(?:\w*:|\/\/)/.test(e)}function o(e){return void 0!==e&&!r(e)}n.d(t,{Z:function(){return o},b:function(){return r}})},8143:function(e,t,n){"use strict";n.r(t),n.d(t,{Redirect:function(){return r.l_},matchPath:function(){return r.LX},useHistory:function(){return r.k6},useLocation:function(){return r.TH}});var r=n(6775)},4996:function(e,t,n){"use strict";n.d(t,{C:function(){return a},Z:function(){return i}});var r=n(2263),o=n(3919);function a(){var e=(0,r.Z)().siteConfig,t=e.baseUrl,n=e.url;return{withBaseUrl:function(e,r){return function(e,t,n,r){var a=void 0===r?{}:r,i=a.forcePrependBaseUrl,s=void 0!==i&&i,c=a.absolute,l=void 0!==c&&c;if(!n)return n;if(n.startsWith("#"))return n;if((0,o.b)(n))return n;if(s)return t+n.replace(/^\//,"");if(n===t.replace(/\/$/,""))return t;var u=n.startsWith(t)?n:t+n.replace(/^\//,"");return l?e+u:u}(n,t,e,r)}}}function i(e,t){return void 0===t&&(t={}),(0,a().withBaseUrl)(e,t)}},2263:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7294),o=n(8940);function a(){return(0,r.useContext)(o._)}},8084:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return a},useAllPluginInstancesData:function(){return i},usePluginData:function(){return s}});var r=n(2263),o=n(9935);function a(){var e=(0,r.Z)().globalData;if(!e)throw new Error("Docusaurus global data not found.");return e}function i(e){var t=a()[e];if(!t)throw new Error('Docusaurus plugin global data not found for "'+e+'" plugin.');return t}function s(e,t){void 0===t&&(t=o.m);var n=i(e)[t];if(!n)throw new Error('Docusaurus plugin global data not found for "'+e+'" plugin with id "'+t+'".');return n}},2389:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7294),o=n(8934);function a(){return(0,r.useContext)(o._)}},9670:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});function r(e){var t={};return function e(n,r){Object.entries(n).forEach((function(n){var o,a=n[0],i=n[1],s=r?r+"."+a:a;"object"==typeof(o=i)&&o&&Object.keys(o).length>0?e(i,s):t[s]=i}))}(e),t}},226:function(e,t,n){"use strict";n.d(t,{_:function(){return o},z:function(){return a}});var r=n(7294),o=r.createContext(null);function a(e){var t=e.children,n=e.value,a=r.useContext(o),i=(0,r.useMemo)((function(){return function(e){var t=e.parent,n=e.value;if(!t){if(!n)throw new Error("Unexpected: no Docusaurus route context found");if(!("plugin"in n))throw new Error("Unexpected: Docusaurus topmost route context has no `plugin` attribute");return n}var r=Object.assign({},t.data,null==n?void 0:n.data);return{plugin:t.plugin,data:r}}({parent:a,value:n})}),[a,n]);return r.createElement(o.Provider,{value:i},t)}},4953:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(7294),o=n(2600),a=n(780),i=n(5742);function s(e){var t=e.error,n=e.tryAgain;return r.createElement("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"50vh",width:"100%",fontSize:"20px"}},r.createElement("h1",null,"This page crashed."),r.createElement("p",null,t.message),r.createElement("button",{type:"button",onClick:n},"Try again"))}function c(e){var t=e.error,n=e.tryAgain;return r.createElement(a.Z,{fallback:function(){return r.createElement(s,{error:t,tryAgain:n})}},r.createElement(i.Z,null,r.createElement("title",null,"Page Error")),r.createElement(o.Z,null,r.createElement(s,{error:t,tryAgain:n})))}},8408:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getDocVersionSuggestions=t.getActiveDocContext=t.getActiveVersion=t.getLatestVersion=t.getActivePlugin=void 0;var r=n(8143);t.getActivePlugin=function(e,t,n){void 0===n&&(n={});var o=Object.entries(e).sort((function(e,t){return t[1].path.localeCompare(e[1].path)})).find((function(e){var n=e[1];return!!(0,r.matchPath)(t,{path:n.path,exact:!1,strict:!1})})),a=o?{pluginId:o[0],pluginData:o[1]}:void 0;if(!a&&n.failfast)throw new Error("Can't find active docs plugin for \""+t+'" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: '+Object.values(e).map((function(e){return e.path})).join(", "));return a};t.getLatestVersion=function(e){return e.versions.find((function(e){return e.isLast}))};t.getActiveVersion=function(e,n){var o=(0,t.getLatestVersion)(e);return[].concat(e.versions.filter((function(e){return e!==o})),[o]).find((function(e){return!!(0,r.matchPath)(n,{path:e.path,exact:!1,strict:!1})}))};t.getActiveDocContext=function(e,n){var o,a,i=(0,t.getActiveVersion)(e,n),s=null==i?void 0:i.docs.find((function(e){return!!(0,r.matchPath)(n,{path:e.path,exact:!0,strict:!1})}));return{activeVersion:i,activeDoc:s,alternateDocVersions:s?(o=s.id,a={},e.versions.forEach((function(e){e.docs.forEach((function(t){t.id===o&&(a[e.name]=t)}))})),a):{}}};t.getDocVersionSuggestions=function(e,n){var r=(0,t.getLatestVersion)(e),o=(0,t.getActiveDocContext)(e,n);return{latestDocSuggestion:null==o?void 0:o.alternateDocVersions[r.name],latestVersionSuggestion:r}}},5551:function(e,t,n){"use strict";t.Jo=t.Iw=t.zu=t.yW=t.gB=t.WS=t.gA=t.zh=t._r=void 0;var r=n(655),o=n(8143),a=r.__importStar(n(8084)),i=n(8408),s={};t._r=function(){var e;return null!=(e=(0,a.default)()["docusaurus-plugin-content-docs"])?e:s};t.zh=function(e){return(0,a.usePluginData)("docusaurus-plugin-content-docs",e)};t.gA=function(e){void 0===e&&(e={});var n=(0,t._r)(),r=(0,o.useLocation)().pathname;return(0,i.getActivePlugin)(n,r,e)};t.WS=function(e){void 0===e&&(e={});var n=(0,t.gA)(e),r=(0,o.useLocation)().pathname;if(n)return{activePlugin:n,activeVersion:(0,i.getActiveVersion)(n.pluginData,r)}};t.gB=function(e){return(0,t.zh)(e).versions};t.yW=function(e){var n=(0,t.zh)(e);return(0,i.getLatestVersion)(n)};t.zu=function(e){var n=(0,t.zh)(e),r=(0,o.useLocation)().pathname;return(0,i.getActiveVersion)(n,r)};t.Iw=function(e){var n=(0,t.zh)(e),r=(0,o.useLocation)().pathname;return(0,i.getActiveDocContext)(n,r)};t.Jo=function(e){var n=(0,t.zh)(e),r=(0,o.useLocation)().pathname;return(0,i.getDocVersionSuggestions)(n,r)}},541:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7294),o="iconExternalLink_I5OW";function a(e){var t=e.width,n=void 0===t?13.5:t,a=e.height,i=void 0===a?13.5:a;return r.createElement("svg",{width:n,height:i,"aria-hidden":"true",viewBox:"0 0 24 24",className:o},r.createElement("path",{fill:"currentColor",d:"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"}))}},2600:function(e,t,n){"use strict";n.d(t,{Z:function(){return we}});var r=n(7294),o=n(6010),a=n(780),i=n(6775),s=n(5999),c=n(5979),l="skipToContent_ZgBM";function u(e){e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")}function d(){var e=(0,r.useRef)(null),t=(0,i.k6)().action;return(0,c.SL)((function(n){var r=n.location;e.current&&!r.hash&&"PUSH"===t&&u(e.current)})),r.createElement("div",{ref:e,role:"region"},r.createElement("a",{href:"#",className:l,onClick:function(e){e.preventDefault();var t=document.querySelector("main:first-of-type")||document.querySelector(".main-wrapper");t&&u(t)}},r.createElement(s.Z,{id:"theme.common.skipToMainContent",description:"The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation"},"Skip to main content")))}var p=n(7462),f=n(3366),m=["width","height","color","strokeWidth","className"];function h(e){var t=e.width,n=void 0===t?21:t,o=e.height,a=void 0===o?21:o,i=e.color,s=void 0===i?"currentColor":i,c=e.strokeWidth,l=void 0===c?1.2:c,u=(e.className,(0,f.Z)(e,m));return r.createElement("svg",(0,p.Z)({viewBox:"0 0 15 15",width:n,height:a},u),r.createElement("g",{stroke:s,strokeWidth:l},r.createElement("path",{d:"M.75.75l13.5 13.5M14.25.75L.75 14.25"})))}var b="announcementBar_IbjG",g="announcementBarPlaceholder_NC_W",v="announcementBarClose_FG1z",y="announcementBarContent_KsVm";function w(){var e=(0,c.nT)(),t=e.isActive,n=e.close,a=(0,c.LU)().announcementBar;if(!t)return null;var i=a.content,l=a.backgroundColor,u=a.textColor,d=a.isCloseable;return r.createElement("div",{className:b,style:{backgroundColor:l,color:u},role:"banner"},d&&r.createElement("div",{className:g}),r.createElement("div",{className:y,dangerouslySetInnerHTML:{__html:i}}),d?r.createElement("button",{type:"button",className:(0,o.Z)("clean-btn close",v),onClick:n,"aria-label":(0,s.I)({id:"theme.AnnouncementBar.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of announcement bar"})},r.createElement(h,{width:14,height:14,strokeWidth:3.1})):null)}function k(e){var t=e.header,n=e.primaryMenu,a=e.secondaryMenu,i=(0,c.YW)().shown;return r.createElement("div",{className:"navbar-sidebar"},t,r.createElement("div",{className:(0,o.Z)("navbar-sidebar__items",{"navbar-sidebar__items--show-secondary":i})},r.createElement("div",{className:"navbar-sidebar__item menu"},n),r.createElement("div",{className:"navbar-sidebar__item menu"},a)))}var E=n(2389);function x(e){return r.createElement("svg",(0,p.Z)({viewBox:"0 0 24 24",width:24,height:24},e),r.createElement("path",{fill:"currentColor",d:"M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"}))}function S(e){return r.createElement("svg",(0,p.Z)({viewBox:"0 0 24 24",width:24,height:24},e),r.createElement("path",{fill:"currentColor",d:"M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"}))}var _={toggle:"toggle_S7eR",toggleButton:"toggleButton_rCf9",darkToggleIcon:"darkToggleIcon_nQuB",lightToggleIcon:"lightToggleIcon_v35p",toggleButtonDisabled:"toggleButtonDisabled_Pu9x"};function C(e){var t=e.className,n=e.value,a=e.onChange,i=(0,E.Z)(),c=(0,s.I)({message:"Switch between dark and light mode (currently {mode})",id:"theme.colorToggle.ariaLabel",description:"The ARIA label for the navbar color mode toggle"},{mode:"dark"===n?(0,s.I)({message:"dark mode",id:"theme.colorToggle.ariaLabel.mode.dark",description:"The name for the dark color mode"}):(0,s.I)({message:"light mode",id:"theme.colorToggle.ariaLabel.mode.light",description:"The name for the light color mode"})});return r.createElement("div",{className:(0,o.Z)(_.toggle,t)},r.createElement("button",{className:(0,o.Z)("clean-btn",_.toggleButton,!i&&_.toggleButtonDisabled),type:"button",onClick:function(){return a("dark"===n?"light":"dark")},disabled:!i,title:c,"aria-label":c},r.createElement(x,{className:(0,o.Z)(_.toggleIcon,_.lightToggleIcon)}),r.createElement(S,{className:(0,o.Z)(_.toggleIcon,_.darkToggleIcon)})))}var T=r.memo(C);function L(e){var t=e.className,n=(0,c.LU)().colorMode.disableSwitch,o=(0,c.If)(),a=o.colorMode,i=o.setColorMode;return n?null:r.createElement(T,{className:t,value:a,onChange:i})}var O=n(5537);function j(){return r.createElement(O.Z,{className:"navbar__brand",imageClassName:"navbar__logo",titleClassName:"navbar__title"})}function P(){var e=(0,c.el)();return r.createElement("button",{type:"button",className:"clean-btn navbar-sidebar__close",onClick:function(){return e.toggle()}},r.createElement(h,{color:"var(--ifm-color-emphasis-600)"}))}function A(){return r.createElement("div",{className:"navbar-sidebar__brand"},r.createElement(j,null),r.createElement(L,{className:"margin-right--md"}),r.createElement(P,null))}var R=n(2207);function N(){var e=(0,c.el)(),t=(0,c.LU)().navbar.items;return r.createElement("ul",{className:"menu__list"},t.map((function(t,n){return r.createElement(R.Z,(0,p.Z)({mobile:!0},t,{onClick:function(){return e.toggle()},key:n}))})))}function I(e){return r.createElement("button",(0,p.Z)({},e,{type:"button",className:"clean-btn navbar-sidebar__back"}),r.createElement(s.Z,{id:"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel",description:"The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)"},"\u2190 Back to main menu"))}function D(){var e=0===(0,c.LU)().navbar.items.length,t=(0,c.YW)();return r.createElement(r.Fragment,null,!e&&r.createElement(I,{onClick:function(){return t.hide()}}),t.content)}function M(){var e=(0,c.el)();return(0,c.Ni)(e.shown),e.shouldRender?r.createElement(k,{header:r.createElement(A,null),primaryMenu:r.createElement(N,null),secondaryMenu:r.createElement(D,null)}):null}var F="navbarHideable_ObN2",B="navbarHidden_FtgE";function z(e){return r.createElement("div",(0,p.Z)({role:"presentation"},e,{className:(0,o.Z)("navbar-sidebar__backdrop",e.className)}))}function U(e){var t=e.children,n=(0,c.LU)().navbar,a=n.hideOnScroll,i=n.style,s=(0,c.el)(),l=(0,c.cK)(a),u=l.navbarRef,d=l.isNavbarVisible;return r.createElement("nav",{ref:u,className:(0,o.Z)("navbar","navbar--fixed-top",a&&[F,!d&&B],{"navbar--dark":"dark"===i,"navbar--primary":"primary"===i,"navbar-sidebar--show":s.shown})},t,r.createElement(z,{onClick:s.toggle}),r.createElement(M,null))}var Z=n(4155),q=["width","height","className"];function $(e){var t=e.width,n=void 0===t?30:t,o=e.height,a=void 0===o?30:o,i=e.className,s=(0,f.Z)(e,q);return r.createElement("svg",(0,p.Z)({className:i,width:n,height:a,viewBox:"0 0 30 30","aria-hidden":"true"},s),r.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"}))}function G(){var e=(0,c.el)();return r.createElement("button",{onClick:e.toggle,onKeyDown:e.toggle,"aria-label":"Navigation bar toggle",className:"navbar__toggle clean-btn",type:"button",tabIndex:0},r.createElement($,null))}var H="colorModeToggle_vKtC";function V(e){var t=e.items;return r.createElement(r.Fragment,null,t.map((function(e,t){return r.createElement(R.Z,(0,p.Z)({},e,{key:t}))})))}function W(e){var t=e.left,n=e.right;return r.createElement("div",{className:"navbar__inner"},r.createElement("div",{className:"navbar__items"},t),r.createElement("div",{className:"navbar__items navbar__items--right"},n))}function K(){var e=(0,c.el)(),t=(0,c.LU)().navbar.items,n=(0,c.A5)(t),o=n[0],a=n[1],i=!t.some((function(e){return"search"===e.type}));return r.createElement(W,{left:r.createElement(r.Fragment,null,!e.disabled&&r.createElement(G,null),r.createElement(j,null),r.createElement(V,{items:o})),right:r.createElement(r.Fragment,null,r.createElement(V,{items:a}),r.createElement(L,{className:H}),i&&r.createElement(Z.Z,null))})}function Y(){return r.createElement(U,null,r.createElement(K,null))}var Q=n(9960),X=n(4996),J=n(3919),ee=n(541),te=["to","href","label","prependBaseUrlToHref"];function ne(e){var t=e.item,n=t.to,o=t.href,a=t.label,i=t.prependBaseUrlToHref,s=(0,f.Z)(t,te),c=(0,X.Z)(n),l=(0,X.Z)(o,{forcePrependBaseUrl:!0});return r.createElement(Q.Z,(0,p.Z)({className:"footer__link-item"},o?{href:i?l:o}:{to:c},s),a,o&&!(0,J.Z)(o)&&r.createElement(ee.Z,null))}function re(e){var t=e.item;return t.html?r.createElement("li",{className:"footer__item",dangerouslySetInnerHTML:{__html:t.html}}):r.createElement("li",{key:t.href||t.to,className:"footer__item"},r.createElement(ne,{item:t}))}function oe(e){var t=e.column;return r.createElement("div",{className:"col footer__col"},r.createElement("div",{className:"footer__title"},t.title),r.createElement("ul",{className:"footer__items"},t.items.map((function(e,t){return r.createElement(re,{key:t,item:e})}))))}function ae(e){var t=e.columns;return r.createElement("div",{className:"row footer__links"},t.map((function(e,t){return r.createElement(oe,{key:t,column:e})})))}function ie(){return r.createElement("span",{className:"footer__link-separator"},"\xb7")}function se(e){var t=e.item;return t.html?r.createElement("span",{className:"footer__link-item",dangerouslySetInnerHTML:{__html:t.html}}):r.createElement(ne,{item:t})}function ce(e){var t=e.links;return r.createElement("div",{className:"footer__links text--center"},r.createElement("div",{className:"footer__links"},t.map((function(e,n){return r.createElement(r.Fragment,{key:n},r.createElement(se,{item:e}),t.length!==n+1&&r.createElement(ie,null))}))))}function le(e){var t=e.links;return(0,c.aV)(t)?r.createElement(ae,{columns:t}):r.createElement(ce,{links:t})}var ue="footerLogoLink_gHmE",de=n(9750);function pe(e){var t,n=e.logo,o=(0,X.C)().withBaseUrl,a={light:o(n.src),dark:o(null!=(t=n.srcDark)?t:n.src)};return r.createElement(de.Z,{className:"footer__logo",alt:n.alt,sources:a,width:n.width,height:n.height})}function fe(e){var t=e.logo;return t.href?r.createElement(Q.Z,{href:t.href,className:ue},r.createElement(pe,{logo:t})):r.createElement(pe,{logo:t})}function me(e){var t=e.copyright;return r.createElement("div",{className:"footer__copyright",dangerouslySetInnerHTML:{__html:t}})}function he(e){var t=e.style,n=e.links,a=e.logo,i=e.copyright;return r.createElement("footer",{className:(0,o.Z)("footer",{"footer--dark":"dark"===t})},r.createElement("div",{className:"container container-fluid"},n,(a||i)&&r.createElement("div",{className:"footer__bottom text--center"},a&&r.createElement("div",{className:"margin-bottom--sm"},a),i)))}function be(){var e=(0,c.LU)().footer;if(!e)return null;var t=e.copyright,n=e.links,o=e.logo,a=e.style;return r.createElement(he,{style:a,links:n&&n.length>0&&r.createElement(le,{links:n}),logo:o&&r.createElement(fe,{logo:o}),copyright:t&&r.createElement(me,{copyright:t})})}var ge=r.memo(be);function ve(e){var t=e.children;return r.createElement(c.SG,null,r.createElement(c.pl,null,r.createElement(c.z5,null,r.createElement(c.OC,null,r.createElement(c.L5,null,r.createElement(c.VC,null,r.createElement(c.Vy,null,t)))))))}function ye(e){var t=e.error,n=e.tryAgain;return r.createElement("main",{className:"container margin-vert--xl"},r.createElement("div",{className:"row"},r.createElement("div",{className:"col col--6 col--offset-3"},r.createElement("h1",{className:"hero__title"},r.createElement(s.Z,{id:"theme.ErrorPageContent.title",description:"The title of the fallback page when the page crashed"},"This page crashed.")),r.createElement("p",null,t.message),r.createElement("div",null,r.createElement("button",{type:"button",onClick:n},r.createElement(s.Z,{id:"theme.ErrorPageContent.tryAgain",description:"The label of the button to try again when the page crashed"},"Try again"))))))}function we(e){var t=e.children,n=e.noFooter,i=e.wrapperClassName,s=e.title,l=e.description;return(0,c.t$)(),r.createElement(ve,null,r.createElement(c.d,{title:s,description:l}),r.createElement(d,null),r.createElement(w,null),r.createElement(Y,null),r.createElement("div",{className:(0,o.Z)(c.kM.wrapper.main,i)},r.createElement(a.Z,{fallback:ye},t)),!n&&r.createElement(ge,null))}},5537:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var r=n(7462),o=n(3366),a=n(7294),i=n(9960),s=n(9750),c=n(4996),l=n(2263),u=n(5979),d=["imageClassName","titleClassName"];function p(e){var t=(0,l.Z)().siteConfig.title,n=(0,u.LU)().navbar,p=n.title,f=n.logo,m=void 0===f?{src:""}:f,h=e.imageClassName,b=e.titleClassName,g=(0,o.Z)(e,d),v=(0,c.Z)(m.href||"/"),y={light:(0,c.Z)(m.src),dark:(0,c.Z)(m.srcDark||m.src)},w=a.createElement(s.Z,{sources:y,height:m.height,width:m.width,alt:m.alt||p||t});return a.createElement(i.Z,(0,r.Z)({to:v},g,m.target&&{target:m.target}),m.src&&(h?a.createElement("div",{className:h},w):w),null!=p&&a.createElement("b",{className:b},p))}},5525:function(e,t,n){"use strict";n.d(t,{Z:function(){return m}});var r=n(7462),o=n(3366),a=n(7294),i=n(6010),s=n(3072),c=n(1068),l=["className","isDropdownItem"],u=["className","isDropdownItem"],d=["mobile","position"];function p(e){var t=e.className,n=e.isDropdownItem,c=void 0!==n&&n,u=(0,o.Z)(e,l),d=a.createElement(s.Z,(0,r.Z)({className:(0,i.Z)(c?"dropdown__link":"navbar__item navbar__link",t)},u));return c?a.createElement("li",null,d):d}function f(e){var t=e.className,n=(e.isDropdownItem,(0,o.Z)(e,u));return a.createElement("li",{className:"menu__list-item"},a.createElement(s.Z,(0,r.Z)({className:(0,i.Z)("menu__link",t)},n)))}function m(e){var t,n=e.mobile,i=void 0!==n&&n,s=(e.position,(0,o.Z)(e,d)),l=i?f:p;return a.createElement(l,(0,r.Z)({},s,{activeClassName:null!=(t=s.activeClassName)?t:(0,c.E)(i)}))}},6400:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var r=n(7462),o=n(3366),a=n(7294),i=n(5525),s=n(5551),c=n(6010),l=n(1068),u=n(5979),d=["docId","label","docsPluginId"];function p(e){var t,n=e.docId,p=e.label,f=e.docsPluginId,m=(0,o.Z)(e,d),h=(0,s.Iw)(f),b=h.activeVersion,g=h.activeDoc,v=(0,u.J)(f).preferredVersion,y=(0,s.yW)(f),w=function(e,t){var n=e.flatMap((function(e){return e.docs})),r=n.find((function(e){return e.id===t}));if(!r){var o=n.map((function(e){return e.id})).join("\n- ");throw new Error("DocNavbarItem: couldn't find any doc with id \""+t+'" in version'+(e.length?"s":"")+" "+e.map((function(e){return e.name})).join(", ")+'".\nAvailable doc ids are:\n- '+o)}return r}((0,u.jj)([b,v,y].filter(Boolean)),n),k=(0,l.E)(m.mobile);return a.createElement(i.Z,(0,r.Z)({exact:!0},m,{className:(0,c.Z)(m.className,(t={},t[k]=(null==g?void 0:g.sidebar)&&g.sidebar===w.sidebar,t)),activeClassName:k,label:null!=p?p:w.id,to:w.path}))}},4792:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var r=n(7462),o=n(3366),a=n(7294),i=n(5525),s=n(5551),c=n(6010),l=n(1068),u=n(5979),d=["sidebarId","label","docsPluginId"];function p(e){var t,n=e.sidebarId,p=e.label,f=e.docsPluginId,m=(0,o.Z)(e,d),h=(0,s.Iw)(f),b=h.activeVersion,g=h.activeDoc,v=(0,u.J)(f).preferredVersion,y=(0,s.yW)(f),w=function(e,t){var n=e.flatMap((function(e){if(e.sidebars)return Object.entries(e.sidebars)})).filter((function(e){return!!e})),r=n.find((function(e){return e[0]===t}));if(!r)throw new Error("DocSidebarNavbarItem: couldn't find any sidebar with id \""+t+'" in version'+(e.length?"s":"")+" "+e.map((function(e){return e.name})).join(", ")+'".\nAvailable sidebar ids are:\n- '+Object.keys(n).join("\n- "));if(!r[1].link)throw new Error("DocSidebarNavbarItem: couldn't find any document for sidebar with id \""+t+'"');return r[1].link}((0,u.jj)([b,v,y].filter(Boolean)),n),k=(0,l.E)(m.mobile);return a.createElement(i.Z,(0,r.Z)({exact:!0},m,{className:(0,c.Z)(m.className,(t={},t[k]=(null==g?void 0:g.sidebar)===n,t)),activeClassName:k,label:null!=p?p:w.label,to:w.path}))}},9308:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(7462),o=n(3366),a=n(7294),i=n(5525),s=n(3154),c=n(5551),l=n(5979),u=n(5999),d=["mobile","docsPluginId","dropdownActiveClassDisabled","dropdownItemsBefore","dropdownItemsAfter"],p=function(e){return e.docs.find((function(t){return t.id===e.mainDocId}))};function f(e){var t,n,f=e.mobile,m=e.docsPluginId,h=e.dropdownActiveClassDisabled,b=e.dropdownItemsBefore,g=e.dropdownItemsAfter,v=(0,o.Z)(e,d),y=(0,c.Iw)(m),w=(0,c.gB)(m),k=(0,c.yW)(m),E=(0,l.J)(m),x=E.preferredVersion,S=E.savePreferredVersionName;var _,C=(_=w.map((function(e){var t=(null==y?void 0:y.alternateDocVersions[e.name])||p(e);return{isNavLink:!0,label:e.label,to:t.path,isActive:function(){return e===(null==y?void 0:y.activeVersion)},onClick:function(){S(e.name)}}})),[].concat(b,_,g)),T=null!=(t=null!=(n=y.activeVersion)?n:x)?t:k,L=f&&C.length>1?(0,u.I)({id:"theme.navbar.mobileVersionsDropdown.label",message:"Versions",description:"The label for the navbar versions dropdown on mobile view"}):T.label,O=f&&C.length>1?void 0:p(T).path;return C.length<=1?a.createElement(i.Z,(0,r.Z)({},v,{mobile:f,label:L,to:O,isActive:h?function(){return!1}:void 0})):a.createElement(s.Z,(0,r.Z)({},v,{mobile:f,label:L,to:O,items:C,isActive:h?function(){return!1}:void 0}))}},7250:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7462),o=n(3366),a=n(7294),i=n(5525),s=n(5551),c=n(5979),l=["label","to","docsPluginId"];function u(e){var t,n=e.label,u=e.to,d=e.docsPluginId,p=(0,o.Z)(e,l),f=(0,s.zu)(d),m=(0,c.J)(d).preferredVersion,h=(0,s.yW)(d),b=null!=(t=null!=f?f:m)?t:h,g=null!=n?n:b.label,v=null!=u?u:function(e){return e.docs.find((function(t){return t.id===e.mainDocId}))}(b).path;return a.createElement(i.Z,(0,r.Z)({},p,{label:g,to:v}))}},3154:function(e,t,n){"use strict";n.d(t,{Z:function(){return b}});var r=n(7462),o=n(3366),a=n(7294),i=n(6010),s=n(5979),c=n(3072),l=n(2207),u=["items","position","className"],d=["items","className","position"],p=["mobile"];function f(e,t){return e.some((function(e){return function(e,t){return!!(0,s.Mg)(e.to,t)||!!(0,s.Fx)(e.activeBaseRegex,t)||!(!e.activeBasePath||!t.startsWith(e.activeBasePath))}(e,t)}))}function m(e){var t,n=e.items,s=e.position,d=e.className,p=(0,o.Z)(e,u),f=(0,a.useRef)(null),m=(0,a.useState)(!1),h=m[0],b=m[1];return(0,a.useEffect)((function(){var e=function(e){f.current&&!f.current.contains(e.target)&&b(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),function(){document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}}),[f]),a.createElement("div",{ref:f,className:(0,i.Z)("navbar__item","dropdown","dropdown--hoverable",{"dropdown--right":"right"===s,"dropdown--show":h})},a.createElement(c.Z,(0,r.Z)({"aria-haspopup":"true","aria-expanded":h,role:"button",href:p.to?void 0:"#",className:(0,i.Z)("navbar__link",d)},p,{onClick:p.to?void 0:function(e){return e.preventDefault()},onKeyDown:function(e){"Enter"===e.key&&(e.preventDefault(),b(!h))}}),null!=(t=p.children)?t:p.label),a.createElement("ul",{className:"dropdown__menu"},n.map((function(e,t){return a.createElement(l.Z,(0,r.Z)({isDropdownItem:!0,onKeyDown:function(e){if(t===n.length-1&&"Tab"===e.key){e.preventDefault(),b(!1);var r=f.current.nextElementSibling;if(r)(r instanceof HTMLAnchorElement?r:r.querySelector("a")).focus()}},activeClassName:"dropdown__link--active"},e,{key:t}))}))))}function h(e){var t,n=e.items,u=e.className,p=(e.position,(0,o.Z)(e,d)),m=(0,s.be)(),h=f(n,m),b=(0,s.uR)({initialState:function(){return!h}}),g=b.collapsed,v=b.toggleCollapsed,y=b.setCollapsed;return(0,a.useEffect)((function(){h&&y(!h)}),[m,h,y]),a.createElement("li",{className:(0,i.Z)("menu__list-item",{"menu__list-item--collapsed":g})},a.createElement(c.Z,(0,r.Z)({role:"button",className:(0,i.Z)("menu__link menu__link--sublist",u)},p,{onClick:function(e){e.preventDefault(),v()}}),null!=(t=p.children)?t:p.label),a.createElement(s.zF,{lazy:!0,as:"ul",className:"menu__list",collapsed:g},n.map((function(e,t){return a.createElement(l.Z,(0,r.Z)({mobile:!0,isDropdownItem:!0,onClick:p.onClick,activeClassName:"menu__link--active"},e,{key:t}))}))))}function b(e){var t=e.mobile,n=void 0!==t&&t,r=(0,o.Z)(e,p),i=n?h:m;return a.createElement(i,r)}},3072:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var r=n(7462),o=n(3366),a=n(7294),i=n(9960),s=n(4996),c=n(541),l=n(3919),u=n(5979),d=["activeBasePath","activeBaseRegex","to","href","label","activeClassName","prependBaseUrlToHref"];function p(e){var t,n=e.activeBasePath,p=e.activeBaseRegex,f=e.to,m=e.href,h=e.label,b=e.activeClassName,g=void 0===b?"":b,v=e.prependBaseUrlToHref,y=(0,o.Z)(e,d),w=(0,s.Z)(f),k=(0,s.Z)(n),E=(0,s.Z)(m,{forcePrependBaseUrl:!0}),x=h&&m&&!(0,l.Z)(m),S="dropdown__link--active"===g;return a.createElement(i.Z,(0,r.Z)({},m?{href:v?E:m}:Object.assign({isNavLink:!0,activeClassName:null!=(t=y.className)&&t.includes(g)?"":g,to:w},n||p?{isActive:function(e,t){return p?(0,u.Fx)(p,t.pathname):t.pathname.startsWith(k)}}:null),y),h,x&&a.createElement(c.Z,S&&{width:12,height:12}))}},2207:function(e,t,n){"use strict";n.d(t,{Z:function(){return w}});var r=n(3366),o=n(7294),a=n(5525),i=n(3154),s=n(7462),c=["width","height"];function l(e){var t=e.width,n=void 0===t?20:t,a=e.height,i=void 0===a?20:a,l=(0,r.Z)(e,c);return o.createElement("svg",(0,s.Z)({viewBox:"0 0 24 24",width:n,height:i,"aria-hidden":!0},l),o.createElement("path",{fill:"currentColor",d:"M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"}))}var u=n(2263),d=n(5979),p=n(5999),f="iconLanguage_dNtB",m=["mobile","dropdownItemsBefore","dropdownItemsAfter"];function h(e){var t=e.mobile,n=e.dropdownItemsBefore,a=e.dropdownItemsAfter,c=(0,r.Z)(e,m),h=(0,u.Z)().i18n,b=h.currentLocale,g=h.locales,v=h.localeConfigs,y=(0,d.l5)();function w(e){return v[e].label}var k=g.map((function(e){var t="pathname://"+y.createUrl({locale:e,fullyQualified:!1});return{isNavLink:!0,label:w(e),to:t,target:"_self",autoAddBaseUrl:!1,className:e===b?"dropdown__link--active":""}})),E=[].concat(n,k,a),x=t?(0,p.I)({message:"Languages",id:"theme.navbar.mobileLanguageDropdown.label",description:"The label for the mobile language switcher dropdown"}):w(b);return o.createElement(i.Z,(0,s.Z)({},c,{mobile:t,label:o.createElement("span",null,o.createElement(l,{className:f}),o.createElement("span",null,x)),items:E}))}var b=n(4155);function g(e){return e.mobile?null:o.createElement(b.Z,null)}var v=["type"],y={default:function(){return a.Z},localeDropdown:function(){return h},search:function(){return g},dropdown:function(){return i.Z},docsVersion:function(){return n(7250).Z},docsVersionDropdown:function(){return n(9308).Z},doc:function(){return n(6400).Z},docSidebar:function(){return n(4792).Z}};function w(e){var t=e.type,n=(0,r.Z)(e,v),a=function(e,t){return e&&"default"!==e?e:t?"dropdown":"default"}(t,void 0!==n.items),i=function(e){var t=y[e];if(!t)throw new Error('No NavbarItem component found for type "'+e+'".');return t()}(a);return o.createElement(i,n)}},1068:function(e,t,n){"use strict";n.d(t,{E:function(){return r}});var r=function(e){return e?"menu__link--active":"navbar__link--active"}},4739:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7294),o=n(5742);function a(e){var t=e.locale,n=e.version,a=e.tag,i=t;return r.createElement(o.Z,null,t&&r.createElement("meta",{name:"docusaurus_locale",content:t}),n&&r.createElement("meta",{name:"docusaurus_version",content:n}),a&&r.createElement("meta",{name:"docusaurus_tag",content:a}),i&&r.createElement("meta",{name:"docsearch:language",content:i}),n&&r.createElement("meta",{name:"docsearch:version",content:n}),a&&r.createElement("meta",{name:"docsearch:docusaurus_tag",content:a}))}},9750:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(7462),o=n(3366),a=n(7294),i=n(6010),s=n(2389),c=n(5979),l={themedImage:"themedImage_W2Cr","themedImage--light":"themedImage--light_TfLj","themedImage--dark":"themedImage--dark_oUvU"},u=["sources","className","alt"];function d(e){var t=(0,s.Z)(),n=(0,c.If)().colorMode,d=e.sources,p=e.className,f=e.alt,m=(0,o.Z)(e,u),h=t?"dark"===n?["dark"]:["light"]:["light","dark"];return a.createElement(a.Fragment,null,h.map((function(e){return a.createElement("img",(0,r.Z)({key:e,src:d[e],alt:f,className:(0,i.Z)(l.themedImage,l["themedImage--"+e],p)},m))})))}},467:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return o}});var r=n(9782);function o(e){var t=r.default.themeConfig.prism.additionalLanguages;globalThis.Prism=e,t.forEach((function(e){n(6726)("./prism-"+e)})),delete globalThis.Prism}},2448:function(e,t,n){"use strict";var r=o(n(7410));function o(e){return e&&e.__esModule?e:{default:e}}(0,o(n(467)).default)(r.default)},5979:function(e,t,n){"use strict";n.d(t,{pl:function(){return tt},zF:function(){return Me},SG:function(){return Mt},HX:function(){return be},PO:function(){return He},D_:function(){return E},L5:function(){return fe},bT:function(){return O},qu:function(){return _},FG:function(){return Tt},Vy:function(){return nn},Zo:function(){return Xt},d:function(){return _t},VC:function(){return Lt},OC:function(){return ht},z5:function(){return sn},kM:function(){return Ke},os:function(){return ge},lx:function(){return Ve},Wl:function(){return te},_F:function(){return re},aV:function(){return ft},Fx:function(){return wt},Mg:function(){return X},hC:function(){return un},bc:function(){return G},Vo:function(){return H},nZ:function(){return V},A5:function(){return tn},jj:function(){return We},l5:function(){return M},nT:function(){return nt},uR:function(){return Oe},If:function(){return Ft},_q:function(){return ve},fP:function(){return x},J:function(){return he},Vq:function(){return j},E6:function(){return C},ed:function(){return g},b9:function(){return pt},cK:function(){return ln},Ns:function(){return J},t$:function(){return dn},be:function(){return rt},SL:function(){return _e},Ni:function(){return mn},el:function(){return Vt},YW:function(){return en},c2:function(){return Se},D9:function(){return v},pJ:function(){return fn},RF:function(){return vt},o5:function(){return yt},Ob:function(){return bn},s1:function(){return oe},Si:function(){return ct},UB:function(){return cn},LU:function(){return o},pe:function(){return ye},iP:function(){return qt}});var r=n(2263);function o(){return(0,r.Z)().siteConfig.themeConfig}var a=n(7294);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var s=n(9611);function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&(0,s.Z)(e,t)}function l(){l=function(e,t){return new n(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function n(e,r,o){var a=new RegExp(e,r);return t.set(a,o||t.get(e)),(0,s.Z)(a,n.prototype)}function r(e,n){var r=t.get(n);return Object.keys(r).reduce((function(t,n){return t[n]=e[r[n]],t}),Object.create(null))}return c(n,RegExp),n.prototype.exec=function(t){var n=e.exec.call(this,t);return n&&(n.groups=r(n,this)),n},n.prototype[Symbol.replace]=function(n,o){if("string"==typeof o){var a=t.get(this);return e[Symbol.replace].call(this,n,o.replace(/\$<([^>]+)>/g,(function(e,t){return"$"+a[t]})))}if("function"==typeof o){var s=this;return e[Symbol.replace].call(this,n,(function(){var e=arguments;return"object"!=i(e[e.length-1])&&(e=[].slice.call(e)).push(r(e,s)),o.apply(this,e)}))}return e[Symbol.replace].call(this,n,o)},l.apply(this,arguments)}var u=n(4578);function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function f(e,t,n){return f=p()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&(0,s.Z)(o,n.prototype),o},f.apply(null,arguments)}function m(e){var t="function"==typeof Map?new Map:void 0;return m=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return f(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),(0,s.Z)(r,e)},m(e)}var h=n(412),b=h.Z.canUseDOM?a.useLayoutEffect:a.useEffect;function g(e){var t=(0,a.useRef)(e);return b((function(){t.current=e}),[e]),(0,a.useCallback)((function(){return t.current.apply(t,arguments)}),[])}function v(e){var t=(0,a.useRef)();return b((function(){t.current=e})),t.current}var y=function(e){function t(t,n){var r,o,a,i;return(i=e.call(this)||this).name="ReactContextError",i.message="Hook "+(null==(r=i.stack)||null==(o=r.split("\n")[1])||null==(a=o.match(l(/at (?:\w+\.)?(\w+)/,{name:1})))?void 0:a.groups.name)+" is called outside the <"+t+">. "+(n||""),i}return(0,u.Z)(t,e),t}(m(Error)),w=Symbol("EmptyContext"),k=a.createContext(w);function E(e){var t=e.children,n=(0,a.useState)(null),r=n[0],o=n[1],i=(0,a.useMemo)((function(){return{expandedItem:r,setExpandedItem:o}}),[r]);return a.createElement(k.Provider,{value:i},t)}function x(){var e=(0,a.useContext)(k);if(e===w)throw new y("DocSidebarItemsExpandedStateProvider");return e}var S=a.createContext(null);function _(e){var t=e.children,n=e.version;return a.createElement(S.Provider,{value:n},t)}function C(){var e=(0,a.useContext)(S);if(null===e)throw new y("DocsVersionProvider");return e}var T=Symbol("EmptyContext"),L=a.createContext(T);function O(e){var t=e.children,n=e.sidebar;return a.createElement(L.Provider,{value:n},t)}function j(){var e=(0,a.useContext)(L);if(e===T)throw new y("DocsSidebarProvider");return e}var P="localStorage";function A(e){if(void 0===e&&(e=P),"undefined"==typeof window)throw new Error("Browser storage is not available on Node.js/Docusaurus SSR process.");if("none"===e)return null;try{return window[e]}catch(n){return t=n,R||(console.warn("Docusaurus browser storage is not available.\nPossible reasons: running Docusaurus in an iframe, in an incognito browser session, or using too strict browser privacy settings.",t),R=!0),null}var t}var R=!1;var N={get:function(){return null},set:function(){},del:function(){}};function I(e,t){if("undefined"==typeof window)return function(e){function t(){throw new Error('Illegal storage API usage for storage key "'+e+'".\nDocusaurus storage APIs are not supposed to be called on the server-rendering process.\nPlease only call storage APIs in effects and event handlers.')}return{get:t,set:t,del:t}}(e);var n=A(null==t?void 0:t.persistence);return null===n?N:{get:function(){try{return n.getItem(e)}catch(t){return console.error("Docusaurus storage error, can't get key="+e,t),null}},set:function(t){try{n.setItem(e,t)}catch(r){console.error("Docusaurus storage error, can't set "+e+"="+t,r)}},del:function(){try{n.removeItem(e)}catch(t){console.error("Docusaurus storage error, can't delete key="+e,t)}}}}var D=n(6775);function M(){var e=(0,r.Z)(),t=e.siteConfig,n=t.baseUrl,o=t.url,a=e.i18n,i=a.defaultLocale,s=a.currentLocale,c=(0,D.TH)().pathname,l=s===i?n:n.replace("/"+s+"/","/"),u=c.replace(n,"");return{createUrl:function(e){var t=e.locale;return""+(e.fullyQualified?o:"")+function(e){return e===i?""+l:""+l+e+"/"}(t)+u}}}var F=n(7594),B=n.n(F),z=l(/title=(["'])(.*?)\1/,{quote:1,title:2}),U=l(/\{([\d,-]+)\}/,{range:1}),Z={js:{start:"\\/\\/",end:""},jsBlock:{start:"\\/\\*",end:"\\*\\/"},jsx:{start:"\\{\\s*\\/\\*",end:"\\*\\/\\s*\\}"},python:{start:"#",end:""},html:{start:"\x3c!--",end:"--\x3e"}},q=["highlight-next-line","highlight-start","highlight-end"];function $(e){var t=e.map((function(e){var t=Z[e],n=t.start,r=t.end;return"(?:"+n+"\\s*("+q.join("|")+")\\s*"+r+")"})).join("|");return new RegExp("^\\s*(?:"+t+")\\s*$")}function G(e){var t,n;return null!=(t=null==e||null==(n=e.match(z))?void 0:n.groups.title)?t:""}function H(e){var t=e.split(" ").find((function(e){return e.startsWith("language-")}));return null==t?void 0:t.replace(/language-/,"")}function V(e,t,n){var r=e.replace(/\n$/,"");if(t&&U.test(t)){var o=t.match(U).groups.range;return{highlightLines:B()(o).filter((function(e){return e>0})).map((function(e){return e-1})),code:r}}if(void 0===n)return{highlightLines:[],code:r};for(var a,i=function(e){switch(e){case"js":case"javascript":case"ts":case"typescript":return $(["js","jsBlock"]);case"jsx":case"tsx":return $(["js","jsBlock","jsx"]);case"html":return $(["js","jsBlock","html"]);case"python":case"py":return $(["python"]);default:return $(Object.keys(Z))}}(n),s=r.split("\n"),c="",l=0;le.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Q=n(9637);function X(e,t){var n=function(e){var t;return null==(t=!e||null!=e&&e.endsWith("/")?e:e+"/")?void 0:t.toLowerCase()};return n(e)===n(t)}function J(){var e=(0,r.Z)().siteConfig.baseUrl;return(0,a.useMemo)((function(){return function(e){var t=e.baseUrl;function n(e){return e.path===t&&!0===e.exact}function r(e){return e.path===t&&!e.exact}return function e(t){if(0!==t.length)return t.find(n)||e(t.filter(r).flatMap((function(e){var t;return null!=(t=e.routes)?t:[]})))}(e.routes)}({routes:Q.Z,baseUrl:e})}),[e])}var ee=!!W._r;function te(e){if(e.href)return e.href;for(var t,n=Y(e.items);!(t=n()).done;){var r=t.value;if("link"===r.type)return r.href;if("category"===r.type){var o=te(r);if(o)return o}else if("html"!==r.type)throw new Error("Unexpected category item type for "+JSON.stringify(r))}}var ne=function(e,t){return void 0!==e&&X(e,t)};function re(e,t){return"link"===e.type?ne(e.href,t):"category"===e.type&&(ne(e.href,t)||function(e,t){return e.some((function(e){return re(e,t)}))}(e.items,t))}function oe(){var e,t=j(),n=(0,D.TH)().pathname;if(!1===(null==(e=(0,W.gA)())?void 0:e.pluginData.breadcrumbs)||!t)return null;var r=[];return function e(t){for(var o,a=Y(t);!(o=a()).done;){var i=o.value;if("category"===i.type&&(X(i.href,n)||e(i.items))||"link"===i.type&&X(i.href,n))return r.push(i),!0}return!1}(t),r.reverse()}var ae=n(9935),ie=function(e){return"docs-preferred-version-"+e},se=function(e,t,n){I(ie(e),{persistence:t}).set(n)},ce=function(e,t){return I(ie(e),{persistence:t}).get()},le=function(e,t){I(ie(e),{persistence:t}).del()};var ue=a.createContext(null);function de(){var e=(0,W._r)(),t=o().docs.versionPersistence,n=(0,a.useMemo)((function(){return Object.keys(e)}),[e]),r=(0,a.useState)((function(){return function(e){return Object.fromEntries(e.map((function(e){return[e,{preferredVersionName:null}]})))}(n)})),i=r[0],s=r[1];return(0,a.useEffect)((function(){s(function(e){var t=e.pluginIds,n=e.versionPersistence,r=e.allDocsData;return Object.fromEntries(t.map((function(e){return[e,(t=e,o=ce(t,n),r[t].versions.some((function(e){return e.name===o}))?{preferredVersionName:o}:(le(t,n),{preferredVersionName:null}))];var t,o})))}({allDocsData:e,versionPersistence:t,pluginIds:n}))}),[e,t,n]),[i,(0,a.useMemo)((function(){return{savePreferredVersion:function(e,n){se(e,t,n),s((function(t){var r;return Object.assign({},t,((r={})[e]={preferredVersionName:n},r))}))}}}),[t])]}function pe(e){var t=e.children,n=de();return a.createElement(ue.Provider,{value:n},t)}function fe(e){var t=e.children;return ee?a.createElement(pe,null,t):t}function me(){var e=(0,a.useContext)(ue);if(!e)throw new y("DocsPreferredVersionContextProvider");return e}function he(e){var t;void 0===e&&(e=ae.m);var n=(0,W.zh)(e),r=me(),o=r[0],i=r[1],s=o[e].preferredVersionName;return{preferredVersion:null!=(t=n.versions.find((function(e){return e.name===s})))?t:null,savePreferredVersionName:(0,a.useCallback)((function(t){i.savePreferredVersion(e,t)}),[i,e])}}var be="default";function ge(e,t){return"docs-"+e+"-"+t}function ve(){var e=(0,r.Z)().i18n,t=(0,W._r)(),n=(0,W.WS)(),o=function(){var e=(0,W._r)(),t=me()[0],n=Object.keys(e);return Object.fromEntries(n.map((function(n){return[n,(r=n,a=e[r],i=t[r].preferredVersionName,null!=(o=a.versions.find((function(e){return e.name===i})))?o:null)];var r,o,a,i})))}();var a=[be].concat(Object.keys(t).map((function(e){var r,a,i=(null==n||null==(r=n.activePlugin)?void 0:r.pluginId)===e?n.activeVersion:void 0,s=o[e],c=t[e].versions.find((function(e){return e.isLast}));return ge(e,(null!=(a=null!=i?i:s)?a:c).name)})));return{locale:e.currentLocale,tags:a}}function ye(e){var t=(0,r.Z)().siteConfig,n=t.title,o=t.titleDelimiter;return null!=e&&e.trim().length?e.trim()+" "+o+" "+n:n}var we=["zero","one","two","few","many","other"];function ke(e){return we.filter((function(t){return e.includes(t)}))}var Ee={locale:"en",pluralForms:ke(["one","other"]),select:function(e){return 1===e?"one":"other"}};function xe(){var e=(0,r.Z)().i18n.currentLocale;return(0,a.useMemo)((function(){try{return t=e,n=new Intl.PluralRules(t),{locale:t,pluralForms:ke(n.resolvedOptions().pluralCategories),select:function(e){return n.select(e)}}}catch(r){return console.error('Failed to use Intl.PluralRules for locale "'+e+'".\nDocusaurus will fallback to the default (English) implementation.\nError: '+r.message+"\n"),Ee}var t,n}),[e])}function Se(){var e=xe();return{selectMessage:function(t,n){return function(e,t,n){var r=e.split("|");if(1===r.length)return r[0];r.length>n.pluralForms.length&&console.error("For locale="+n.locale+", a maximum of "+n.pluralForms.length+" plural forms are expected ("+n.pluralForms+"), but the message contains "+r.length+": "+e);var o=n.select(t),a=n.pluralForms.indexOf(o);return r[Math.min(a,r.length-1)]}(n,t,e)}}}function _e(e){var t=(0,D.TH)(),n=v(t),r=g(e);(0,a.useEffect)((function(){n&&t!==n&&r({location:t,previousLocation:n})}),[r,t,n])}var Ce=n(3366),Te=["collapsed"],Le=["lazy"];function Oe(e){var t=e.initialState,n=(0,a.useState)(null!=t&&t),r=n[0],o=n[1],i=(0,a.useCallback)((function(){o((function(e){return!e}))}),[]);return{collapsed:r,setCollapsed:o,toggleCollapsed:i}}var je={display:"none",overflow:"hidden",height:"0px"},Pe={display:"block",overflow:"visible",height:"auto"};function Ae(e,t){var n=t?je:Pe;e.style.display=n.display,e.style.overflow=n.overflow,e.style.height=n.height}function Re(e){var t=e.collapsibleRef,n=e.collapsed,r=e.animation,o=(0,a.useRef)(!1);(0,a.useEffect)((function(){var e,a=t.current;function i(){var e,t,n=a.scrollHeight,o=null!=(e=null==r?void 0:r.duration)?e:function(e){var t=e/36;return Math.round(10*(4+15*Math.pow(t,.25)+t/5))}(n);return{transition:"height "+o+"ms "+(null!=(t=null==r?void 0:r.easing)?t:"ease-in-out"),height:n+"px"}}function s(){var e=i();a.style.transition=e.transition,a.style.height=e.height}if(!o.current)return Ae(a,n),void(o.current=!0);return a.style.willChange="height",e=requestAnimationFrame((function(){n?(s(),requestAnimationFrame((function(){a.style.height=je.height,a.style.overflow=je.overflow}))):(a.style.display="block",requestAnimationFrame((function(){s()})))})),function(){return cancelAnimationFrame(e)}}),[t,n,r])}function Ne(e){if(!h.Z.canUseDOM)return e?je:Pe}function Ie(e){var t=e.as,n=void 0===t?"div":t,r=e.collapsed,o=e.children,i=e.animation,s=e.onCollapseTransitionEnd,c=e.className,l=e.disableSSRStyle,u=(0,a.useRef)(null);return Re({collapsibleRef:u,collapsed:r,animation:i}),a.createElement(n,{ref:u,style:l?void 0:Ne(r),onTransitionEnd:function(e){"height"===e.propertyName&&(Ae(u.current,r),null==s||s(r))},className:c},o)}function De(e){var t=e.collapsed,n=(0,Ce.Z)(e,Te),r=(0,a.useState)(!t),o=r[0],i=r[1];(0,a.useLayoutEffect)((function(){t||i(!0)}),[t]);var s=(0,a.useState)(t),c=s[0],l=s[1];return(0,a.useLayoutEffect)((function(){o&&l(t)}),[o,t]),o?a.createElement(Ie,Object.assign({},n,{collapsed:c})):null}function Me(e){var t=e.lazy,n=(0,Ce.Z)(e,Le),r=t?De:Ie;return a.createElement(r,Object.assign({},n))}var Fe=n(2389),Be=n(6010),ze="details_lb9f",Ue="isBrowser_bmU9",Ze="collapsibleContent_i85q",qe=["summary","children"];function $e(e){return!!e&&("SUMMARY"===e.tagName||$e(e.parentElement))}function Ge(e,t){return!!e&&(e===t||Ge(e.parentElement,t))}function He(e){var t=e.summary,n=e.children,r=(0,Ce.Z)(e,qe),o=(0,Fe.Z)(),i=(0,a.useRef)(null),s=Oe({initialState:!r.open}),c=s.collapsed,l=s.setCollapsed,u=(0,a.useState)(r.open),d=u[0],p=u[1];return a.createElement("details",Object.assign({},r,{ref:i,open:d,"data-collapsed":c,className:(0,Be.Z)(ze,o&&Ue,r.className),onMouseDown:function(e){$e(e.target)&&e.detail>1&&e.preventDefault()},onClick:function(e){e.stopPropagation();var t=e.target;$e(t)&&Ge(t,i.current)&&(e.preventDefault(),c?(l(!1),p(!0)):l(!0))}}),t,a.createElement(Me,{lazy:!1,collapsed:c,disableSSRStyle:!0,onCollapseTransitionEnd:function(e){l(e),p(!e)}},a.createElement("div",{className:Ze},n)))}function Ve(e,t){return void 0===t&&(t=function(e,t){return e===t}),e.filter((function(n,r){return e.findIndex((function(e){return t(e,n)}))!==r}))}function We(e){return Array.from(new Set(e))}var Ke={page:{blogListPage:"blog-list-page",blogPostPage:"blog-post-page",blogTagsListPage:"blog-tags-list-page",blogTagPostListPage:"blog-tags-post-list-page",docsDocPage:"docs-doc-page",docsTagsListPage:"docs-tags-list-page",docsTagDocListPage:"docs-tags-doc-list-page",mdxPage:"mdx-page"},wrapper:{main:"main-wrapper",blogPages:"blog-wrapper",docsPages:"docs-wrapper",mdxPages:"mdx-wrapper"},common:{editThisPage:"theme-edit-this-page",lastUpdated:"theme-last-updated",backToTopButton:"theme-back-to-top-button",codeBlock:"theme-code-block"},layout:{},docs:{docVersionBanner:"theme-doc-version-banner",docVersionBadge:"theme-doc-version-badge",docBreadcrumbs:"theme-doc-breadcrumbs",docMarkdown:"theme-doc-markdown",docTocMobile:"theme-doc-toc-mobile",docTocDesktop:"theme-doc-toc-desktop",docFooter:"theme-doc-footer",docFooterTagsRow:"theme-doc-footer-tags-row",docFooterEditMetaRow:"theme-doc-footer-edit-meta-row",docSidebarContainer:"theme-doc-sidebar-container",docSidebarMenu:"theme-doc-sidebar-menu",docSidebarItemCategory:"theme-doc-sidebar-item-category",docSidebarItemLink:"theme-doc-sidebar-item-link",docSidebarItemCategoryLevel:function(e){return"theme-doc-sidebar-item-category-level-"+e},docSidebarItemLinkLevel:function(e){return"theme-doc-sidebar-item-link-level-"+e}},blog:{}},Ye=I("docusaurus.announcement.dismiss"),Qe=I("docusaurus.announcement.id"),Xe=function(){return"true"===Ye.get()},Je=function(e){return Ye.set(String(e))},et=a.createContext(null);function tt(e){var t=e.children,n=function(){var e=o().announcementBar,t=(0,Fe.Z)(),n=(0,a.useState)((function(){return!!t&&Xe()})),r=n[0],i=n[1];(0,a.useEffect)((function(){i(Xe())}),[]);var s=(0,a.useCallback)((function(){Je(!0),i(!0)}),[]);return(0,a.useEffect)((function(){if(e){var t=e.id,n=Qe.get();"annoucement-bar"===n&&(n="announcement-bar");var r=t!==n;Qe.set(t),r&&Je(!1),!r&&Xe()||i(!1)}}),[e]),(0,a.useMemo)((function(){return{isActive:!!e&&!r,close:s}}),[e,r,s])}();return a.createElement(et.Provider,{value:n},t)}function nt(){var e=(0,a.useContext)(et);if(!e)throw new y("AnnouncementBarProvider");return e}function rt(){var e=(0,r.Z)().siteConfig.baseUrl;return(0,D.TH)().pathname.replace(e,"/")}n(5999);function ot(e){!function(e){var t=(0,D.k6)().block,n=g(e);(0,a.useEffect)((function(){return t((function(e,t){return n(e,t)}))}),[t,n])}((function(t,n){if("POP"===n)return e(t,n)}))}function at(e){var t=e.getBoundingClientRect();return t.top===t.bottom?at(e.parentNode):t}function it(e,t){var n,r,o=t.anchorTopOffset,a=e.find((function(e){return at(e).top>=o}));return a?function(e){return e.top>0&&e.bottom=0?t[n].children.push(o):r.push(o)})),r}function dt(e){var t=e.toc,n=e.minHeadingLevel,r=e.maxHeadingLevel;return t.flatMap((function(e){var t=dt({toc:e.children,minHeadingLevel:n,maxHeadingLevel:r});return function(e){return e.level>=n&&e.level<=r}(e)?[Object.assign({},e,{children:t})]:t}))}function pt(e){var t=e.toc,n=e.minHeadingLevel,r=e.maxHeadingLevel;return(0,a.useMemo)((function(){return dt({toc:ut(t),minHeadingLevel:n,maxHeadingLevel:r})}),[t,n,r])}function ft(e){return"title"in e[0]}var mt=a.createContext(void 0);function ht(e){var t,n=e.children,r=(t=(0,a.useRef)(!0),(0,a.useMemo)((function(){return{scrollEventsEnabledRef:t,enableScrollEvents:function(){t.current=!0},disableScrollEvents:function(){t.current=!1}}}),[]));return a.createElement(mt.Provider,{value:r},n)}function bt(){var e=(0,a.useContext)(mt);if(null==e)throw new y("ScrollControllerProvider");return e}var gt=function(){return h.Z.canUseDOM?{scrollX:window.pageXOffset,scrollY:window.pageYOffset}:null};function vt(e,t){void 0===t&&(t=[]);var n=bt().scrollEventsEnabledRef,r=(0,a.useRef)(gt()),o=g(e);(0,a.useEffect)((function(){var e=function(){if(n.current){var e=gt();o&&o(e,r.current),r.current=e}},t={passive:!0};return e(),window.addEventListener("scroll",e,t),function(){return window.removeEventListener("scroll",e,t)}}),[o,n].concat(t))}function yt(){var e,t,n,r=bt(),o=(e=(0,a.useRef)({elem:null,top:0}),t=(0,a.useCallback)((function(t){e.current={elem:t,top:t.getBoundingClientRect().top}}),[]),n=(0,a.useCallback)((function(){var t=e.current,n=t.elem,r=t.top;if(!n)return{restored:!1};var o=n.getBoundingClientRect().top-r;return o&&window.scrollBy({left:0,top:o}),e.current={elem:null,top:0},{restored:0!==o}}),[]),(0,a.useMemo)((function(){return{save:t,restore:n}}),[n,t])),i=(0,a.useRef)(void 0),s=(0,a.useCallback)((function(e){o.save(e),r.disableScrollEvents(),i.current=function(){var e=o.restore().restored;if(i.current=void 0,e){window.addEventListener("scroll",(function e(){r.enableScrollEvents(),window.removeEventListener("scroll",e)}))}else r.enableScrollEvents()}}),[r,o]);return(0,a.useLayoutEffect)((function(){null==i.current||i.current()})),{blockElementScrollPositionUntilNextRender:s}}function wt(e,t){return void 0!==e&&void 0!==t&&new RegExp(e,"gi").test(t)}var kt=n(5742),Et=n(226);function xt(){var e=a.useContext(Et._);if(!e)throw new Error("Unexpected: no Docusaurus route context found");return e}var St=n(4996);function _t(e){var t=e.title,n=e.description,r=e.keywords,o=e.image,i=e.children,s=ye(t),c=(0,St.C)().withBaseUrl,l=o?c(o,{absolute:!0}):void 0;return a.createElement(kt.Z,null,t&&a.createElement("title",null,s),t&&a.createElement("meta",{property:"og:title",content:s}),n&&a.createElement("meta",{name:"description",content:n}),n&&a.createElement("meta",{property:"og:description",content:n}),r&&a.createElement("meta",{name:"keywords",content:Array.isArray(r)?r.join(","):r}),l&&a.createElement("meta",{property:"og:image",content:l}),l&&a.createElement("meta",{name:"twitter:image",content:l}),i)}var Ct=a.createContext(void 0);function Tt(e){var t=e.className,n=e.children,r=a.useContext(Ct),o=(0,Be.Z)(r,t);return a.createElement(Ct.Provider,{value:o},a.createElement(kt.Z,null,a.createElement("html",{className:o})),n)}function Lt(e){var t=e.children,n=xt(),r="plugin-"+n.plugin.name.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi,""),o="plugin-id-"+n.plugin.id;return a.createElement(Tt,{className:(0,Be.Z)(r,o)},t)}var Ot=a.createContext(void 0),jt="theme",Pt=I(jt),At="light",Rt="dark",Nt=function(e){return e===Rt?Rt:At},It=function(e){Pt.set(Nt(e))};function Dt(){var e=o().colorMode,t=e.defaultMode,n=e.disableSwitch,r=e.respectPrefersColorScheme,i=(0,a.useState)(function(e){return h.Z.canUseDOM?Nt(document.documentElement.getAttribute("data-theme")):Nt(e)}(t)),s=i[0],c=i[1],l=(0,a.useCallback)((function(e){c(e),It(e)}),[]);(0,a.useEffect)((function(){document.documentElement.setAttribute("data-theme",Nt(s))}),[s]),(0,a.useEffect)((function(){if(!n){var e=function(e){if(e.key===jt)try{var t=Pt.get();null!==t&&l(Nt(t))}catch(n){console.error(n)}};return window.addEventListener("storage",e),function(){return window.removeEventListener("storage",e)}}}),[n,l]);var u=(0,a.useRef)(!1);return(0,a.useEffect)((function(){if(!n||r){var e=window.matchMedia("(prefers-color-scheme: dark)"),t=function(e){var t=e.matches;window.matchMedia("print").matches||u.current?u.current=window.matchMedia("print").matches:l(t?Rt:At)};return e.addListener(t),function(){return e.removeListener(t)}}}),[l,n,r]),(0,a.useMemo)((function(){return{colorMode:s,setColorMode:l,get isDarkTheme(){return s===Rt},setLightTheme:function(){l(At),It(At)},setDarkTheme:function(){l(Rt),It(Rt)}}}),[s,l])}function Mt(e){var t=e.children,n=Dt();return a.createElement(Ot.Provider,{value:n},t)}function Ft(){var e=(0,a.useContext)(Ot);if(null==e)throw new y("ColorModeProvider","Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.");return e}var Bt="desktop",zt="mobile",Ut="ssr";function Zt(){return h.Z.canUseDOM?window.innerWidth>996?Bt:zt:Ut}function qt(){var e=(0,a.useState)((function(){return Zt()})),t=e[0],n=e[1];return(0,a.useEffect)((function(){function e(){n(Zt())}return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e),clearTimeout(undefined)}}),[]),t}var $t=a.createContext(void 0);function Gt(){var e,t=(e=(0,W.gA)(),0===o().navbar.items.length&&!e),n=qt(),r=!t&&"mobile"===n,i=(0,a.useState)(!1),s=i[0],c=i[1];ot((function(){if(s)return c(!1),!1}));var l=(0,a.useCallback)((function(){c((function(e){return!e}))}),[]);return(0,a.useEffect)((function(){"desktop"===n&&c(!1)}),[n]),(0,a.useMemo)((function(){return{disabled:t,shouldRender:r,toggle:l,shown:s}}),[t,r,l,s])}function Ht(e){var t=e.children,n=Gt();return a.createElement($t.Provider,{value:n},t)}function Vt(){var e=a.useContext($t);if(void 0===e)throw new y("NavbarMobileSidebarProvider");return e}var Wt={shown:!1,content:{component:null,props:null}},Kt=a.createContext(null);function Yt(e){var t,n,r,o,i,s,c,l,u,d=e.children,p=(r=Vt(),o=(0,a.useState)(Wt),i=o[0],s=o[1],c=function(e){return s((function(t){return Object.assign({},t,{shown:e})}))},l=null!==(null==(t=i.content)?void 0:t.component),u=v(null!==(null==(n=i.content)?void 0:n.component)),(0,a.useEffect)((function(){l&&!u&&c(!0)}),[l,u]),(0,a.useEffect)((function(){l?r.shown||c(!0):c(!1)}),[r.shown,l]),[i,s]);return a.createElement(Kt.Provider,{value:p},d)}function Qt(){var e=(0,a.useContext)(Kt);if(null===e)throw new y("MobileSecondaryMenuProvider");return e}function Xt(e){var t,n=e.component,r=e.props,o=Qt()[1],i=(t=r,(0,a.useMemo)((function(){return t}),[].concat(Object.keys(t),Object.values(t))));return(0,a.useEffect)((function(){o((function(e){return Object.assign({},e,{content:{component:n,props:i}})}))}),[o,n,i]),(0,a.useEffect)((function(){return function(){return o((function(e){return Object.assign({},e,{component:null,props:null})}))}}),[o]),null}function Jt(e){var t;if(null!=(t=e.content)&&t.component){var n=e.content.component;return a.createElement(n,Object.assign({},e.content.props))}}function en(){var e=Qt(),t=e[0],n=e[1],r=(0,a.useCallback)((function(){return n((function(e){return Object.assign({},e,{shown:!1})}))}),[n]);return(0,a.useMemo)((function(){return{shown:t.shown,hide:r,content:Jt(t)}}),[r,t])}function tn(e){function t(e){var t;return"left"===(null!=(t=e.position)?t:"right")}return[e.filter(t),e.filter((function(e){return!t(e)}))]}function nn(e){var t=e.children;return a.createElement(Ht,null,a.createElement(Yt,null,t))}var rn="docusaurus.tab.",on=a.createContext(void 0);function an(){var e=(0,a.useState)({}),t=e[0],n=e[1],r=(0,a.useCallback)((function(e,t){I("docusaurus.tab."+e).set(t)}),[]);(0,a.useEffect)((function(){try{var e={};(function(e){void 0===e&&(e=P);var t=A(e);if(!t)return[];for(var n=[],r=0;r=s?r(!1):a+l=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var v="Ctrl";var y=a.forwardRef((function(e,t){var n=e.translations,r=void 0===n?{}:n,o=g(e,h),i=r.buttonText,s=void 0===i?"Search":i,c=r.buttonAriaLabel,l=void 0===c?"Search":c,u=(0,a.useMemo)((function(){return"undefined"!=typeof navigator?/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)?"\u2318":v:null}),[]);return a.createElement("button",b({type:"button",className:"DocSearch DocSearch-Button","aria-label":l},o,{ref:t}),a.createElement("span",{className:"DocSearch-Button-Container"},a.createElement(m.W,null),a.createElement("span",{className:"DocSearch-Button-Placeholder"},s)),a.createElement("span",{className:"DocSearch-Button-Keys"},null!==u&&a.createElement(a.Fragment,null,a.createElement("span",{className:"DocSearch-Button-Key"},u===v?a.createElement(f,null):u),a.createElement("span",{className:"DocSearch-Button-Key"},"K"))))}));var w=n(5999),k="searchBox_qEbK",E=["contextualSearch","externalUrlRegex"],x=null;function S(e){var t=e.hit,n=e.children;return a.createElement(u.Z,{to:t.url},n)}function _(e){var t=e.state,n=e.onClose,r=(0,p.Ob)().generateSearchPageLink;return a.createElement(u.Z,{to:r(t.query),onClick:n},a.createElement(w.Z,{id:"theme.SearchBar.seeAll",values:{count:t.context.nbHits}},"See all {count} results"))}function C(e){var t,u,f,m,h,b=e.contextualSearch,g=e.externalUrlRegex,v=(0,o.Z)(e,E),C=(0,s.Z)().siteMetadata,T=["language:"+(f=(0,p._q)()).locale,f.tags.map((function(e){return"docusaurus_tag:"+e}))],L=null!=(t=null==(u=v.searchParameters)?void 0:u.facetFilters)?t:[],O=b?(m=L,[].concat((h=function(e){return"string"==typeof e?[e]:e})(T),h(m))):L,j=Object.assign({},v.searchParameters,{facetFilters:O}),P=(0,l.C)().withBaseUrl,A=(0,c.k6)(),R=(0,a.useRef)(null),N=(0,a.useRef)(null),I=(0,a.useState)(!1),D=I[0],M=I[1],F=(0,a.useState)(void 0),B=F[0],z=F[1],U=(0,a.useCallback)((function(){return x?Promise.resolve():Promise.all([n.e(6815).then(n.bind(n,6815)),Promise.all([n.e(532),n.e(6945)]).then(n.bind(n,6945)),Promise.all([n.e(532),n.e(8894)]).then(n.bind(n,8894))]).then((function(e){var t=e[0].DocSearchModal;x=t}))}),[]),Z=(0,a.useCallback)((function(){U().then((function(){R.current=document.createElement("div"),document.body.insertBefore(R.current,document.body.firstChild),M(!0)}))}),[U,M]),q=(0,a.useCallback)((function(){var e;M(!1),null==(e=R.current)||e.remove()}),[M]),$=(0,a.useCallback)((function(e){U().then((function(){M(!0),z(e.key)}))}),[U,M,z]),G=(0,a.useRef)({navigate:function(e){var t=e.itemUrl;(0,p.Fx)(g,t)?window.location.href=t:A.push(t)}}).current,H=(0,a.useRef)((function(e){return e.map((function(e){if((0,p.Fx)(g,e.url))return e;var t=new URL(e.url);return Object.assign({},e,{url:P(""+t.pathname+t.hash)})}))})).current,V=(0,a.useMemo)((function(){return function(e){return a.createElement(_,(0,r.Z)({},e,{onClose:q}))}}),[q]),W=(0,a.useCallback)((function(e){return e.addAlgoliaAgent("docusaurus",C.docusaurusVersion),e}),[C.docusaurusVersion]);!function(e){var t=e.isOpen,n=e.onOpen,r=e.onClose,o=e.onInput,i=e.searchButtonRef;a.useEffect((function(){function e(e){(27===e.keyCode&&t||"k"===e.key&&(e.metaKey||e.ctrlKey)||!function(e){var t=e.target,n=t.tagName;return t.isContentEditable||"INPUT"===n||"SELECT"===n||"TEXTAREA"===n}(e)&&"/"===e.key&&!t)&&(e.preventDefault(),t?r():document.body.classList.contains("DocSearch--active")||document.body.classList.contains("DocSearch--active")||n()),i&&i.current===document.activeElement&&o&&/[a-zA-Z0-9]/.test(String.fromCharCode(e.keyCode))&&o(e)}return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}),[t,n,r,o,i])}({isOpen:D,onOpen:Z,onClose:q,onInput:$,searchButtonRef:N});var K=(0,w.I)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"});return a.createElement(a.Fragment,null,a.createElement(d.Z,null,a.createElement("link",{rel:"preconnect",href:"https://"+v.appId+"-dsn.algolia.net",crossOrigin:"anonymous"})),a.createElement("div",{className:k},a.createElement(y,{onTouchStart:U,onFocus:U,onMouseOver:U,onClick:Z,ref:N,translations:{buttonText:K,buttonAriaLabel:K}})),D&&x&&R.current&&(0,i.createPortal)(a.createElement(x,(0,r.Z)({onClose:q,initialScrollY:window.scrollY,initialQuery:B,navigator:G,transformItems:H,hitComponent:S,transformSearchClient:W},v.searchPagePath&&{resultsFooterComponent:V},v,{searchParameters:j})),R.current))}function T(){var e=(0,s.Z)().siteConfig;return a.createElement(C,e.themeConfig.algolia)}},8802:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=t.trailingSlash,r=t.baseUrl;if(e.startsWith("#"))return e;if(void 0===n)return e;var o,a=e.split(/[#?]/)[0],i="/"===a||a===r?a:(o=a,n?function(e){return e.endsWith("/")?e:e+"/"}(o):function(e){return e.endsWith("/")?e.slice(0,-1):e}(o));return e.replace(a,i)}},8780:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.applyTrailingSlash=t.blogPostContainerID=void 0,t.blogPostContainerID="post-content";var o=n(8802);Object.defineProperty(t,"applyTrailingSlash",{enumerable:!0,get:function(){return r(o).default}})},6010:function(e,t,n){"use strict";function r(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t=0;p--){var f=i[p];"."===f?a(i,p):".."===f?(a(i,p),d++):d&&(a(i,p),d--)}if(!l)for(;d--;d)i.unshift("..");!l||""===i[0]||i[0]&&o(i[0])||i.unshift("");var m=i.join("/");return n&&"/"!==m.substr(-1)&&(m+="/"),m};function s(e){return e.valueOf?e.valueOf():Object.prototype.valueOf.call(e)}var c=function e(t,n){if(t===n)return!0;if(null==t||null==n)return!1;if(Array.isArray(t))return Array.isArray(n)&&t.length===n.length&&t.every((function(t,r){return e(t,n[r])}));if("object"==typeof t||"object"==typeof n){var r=s(t),o=s(n);return r!==t||o!==n?e(r,o):Object.keys(Object.assign({},t,n)).every((function(r){return e(t[r],n[r])}))}return!1},l=n(2177);function u(e){return"/"===e.charAt(0)?e:"/"+e}function d(e){return"/"===e.charAt(0)?e.substr(1):e}function p(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function f(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function m(e){var t=e.pathname,n=e.search,r=e.hash,o=t||"/";return n&&"?"!==n&&(o+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(o+="#"===r.charAt(0)?r:"#"+r),o}function h(e,t,n,o){var a;"string"==typeof e?(a=function(e){var t=e||"/",n="",r="",o=t.indexOf("#");-1!==o&&(r=t.substr(o),t=t.substr(0,o));var a=t.indexOf("?");return-1!==a&&(n=t.substr(a),t=t.substr(0,a)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e),a.state=t):(void 0===(a=(0,r.Z)({},e)).pathname&&(a.pathname=""),a.search?"?"!==a.search.charAt(0)&&(a.search="?"+a.search):a.search="",a.hash?"#"!==a.hash.charAt(0)&&(a.hash="#"+a.hash):a.hash="",void 0!==t&&void 0===a.state&&(a.state=t));try{a.pathname=decodeURI(a.pathname)}catch(s){throw s instanceof URIError?new URIError('Pathname "'+a.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):s}return n&&(a.key=n),o?a.pathname?"/"!==a.pathname.charAt(0)&&(a.pathname=i(a.pathname,o.pathname)):a.pathname=o.pathname:a.pathname||(a.pathname="/"),a}function b(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash&&e.key===t.key&&c(e.state,t.state)}function g(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,o){if(null!=e){var a="function"==typeof e?e(t,n):e;"string"==typeof a?"function"==typeof r?r(a,o):o(!0):o(!1!==a)}else o(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;rt?n.splice(t,n.length-t,o):n.push(o),d({action:r,location:o,index:t,entries:n})}}))},replace:function(e,t){var r="REPLACE",o=h(e,t,p(),w.location);u.confirmTransitionTo(o,r,n,(function(e){e&&(w.entries[w.index]=o,d({action:r,location:o}))}))},go:y,goBack:function(){y(-1)},goForward:function(){y(1)},canGo:function(e){var t=w.index+e;return t>=0&&t
'};function o(e,t,n){return en?n:e}function a(e){return 100*(-1+e)}function i(e,t,n){var o;return(o="translate3d"===r.positionUsing?{transform:"translate3d("+a(e)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+a(e)+"%,0)"}:{"margin-left":a(e)+"%"}).transition="all "+t+"ms "+n,o}n.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},n.status=null,n.set=function(e){var t=n.isStarted();e=o(e,r.minimum,1),n.status=1===e?null:e;var a=n.render(!t),l=a.querySelector(r.barSelector),u=r.speed,d=r.easing;return a.offsetWidth,s((function(t){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),c(l,i(e,u,d)),1===e?(c(a,{transition:"none",opacity:1}),a.offsetWidth,setTimeout((function(){c(a,{transition:"all "+u+"ms linear",opacity:0}),setTimeout((function(){n.remove(),t()}),u)}),u)):setTimeout(t,u)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var e=function(){setTimeout((function(){n.status&&(n.trickle(),e())}),r.trickleSpeed)};return r.trickle&&e(),this},n.done=function(e){return e||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(e){var t=n.status;return t?("number"!=typeof e&&(e=(1-t)*o(Math.random()*t,.1,.95)),t=o(t+e,0,.994),n.set(t)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},e=0,t=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===t&&n.start(),e++,t++,r.always((function(){0==--t?(e=0,n.done()):n.set((e-t)/e)})),this):this},n.render=function(e){if(n.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var o,i=t.querySelector(r.barSelector),s=e?"-100":a(n.status||0),l=document.querySelector(r.parent);return c(i,{transition:"all 0 linear",transform:"translate3d("+s+"%,0,0)"}),r.showSpinner||(o=t.querySelector(r.spinnerSelector))&&f(o),l!=document.body&&u(l,"nprogress-custom-parent"),l.appendChild(t),t},n.remove=function(){d(document.documentElement,"nprogress-busy"),d(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&f(e)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var s=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),c=function(){var e=["Webkit","O","Moz","ms"],t={};function n(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function r(t){var n=document.body.style;if(t in n)return t;for(var r,o=e.length,a=t.charAt(0).toUpperCase()+t.slice(1);o--;)if((r=e[o]+a)in n)return r;return t}function o(e){return e=n(e),t[e]||(t[e]=r(e))}function a(e,t,n){t=o(t),e.style[t]=n}return function(e,t){var n,r,o=arguments;if(2==o.length)for(n in t)void 0!==(r=t[n])&&t.hasOwnProperty(n)&&a(e,n,r);else a(e,o[1],o[2])}}();function l(e,t){return("string"==typeof e?e:p(e)).indexOf(" "+t+" ")>=0}function u(e,t){var n=p(e),r=n+t;l(n,t)||(e.className=r.substring(1))}function d(e,t){var n,r=p(e);l(e,t)&&(n=r.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function p(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function f(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return n},void 0===(o="function"==typeof r?r.call(t,n,t,e):r)||(e.exports=o)},7418:function(e){"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function o(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(o){return!1}}()?Object.assign:function(e,a){for(var i,s,c=o(e),l=1;le.trim())))if(/^-?\d+$/.test(r))n.push(parseInt(r,10));else if(t=r.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){let[e,r,o,a]=t;if(r&&a){r=parseInt(r),a=parseInt(a);const e=r=d.reach);x+=E.value.length,E=E.next){var S=E.value;if(t.length>e.length)return;if(!(S instanceof o)){var _,C=1;if(v){if(!(_=a(k,x,e,g))||_.index>=e.length)break;var T=_.index,L=_.index+_[0].length,O=x;for(O+=E.value.length;T>=O;)O+=(E=E.next).value.length;if(x=O-=E.value.length,E.value instanceof o)continue;for(var j=E;j!==t.tail&&(Od.reach&&(d.reach=N);var I=E.prev;if(A&&(I=c(t,I,A),x+=A.length),l(t,I,C),E=c(t,I,new o(p,b?r.tokenize(P,b):P,y,P)),R&&c(t,E,R),C>1){var D={cause:p+","+m,reach:N};i(e,t,n,E.prev,x,D),d&&D.reach>d.reach&&(d.reach=D.reach)}}}}}}function s(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,n){var r=t.next,o={value:n,prev:t,next:r};return t.next=o,r.prev=o,e.length++,o}function l(e,t,n){for(var r=t.next,o=0;o"+a.content+""},r}(),o=r;r.default=r,o.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},o.languages.markup.tag.inside["attr-value"].inside.entity=o.languages.markup.entity,o.languages.markup.doctype.inside["internal-subset"].inside=o.languages.markup,o.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(o.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:o.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:o.languages[t]};var a={};a[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},o.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(o.languages.markup.tag,"addAttribute",{value:function(e,t){o.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:o.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),o.languages.html=o.languages.markup,o.languages.mathml=o.languages.markup,o.languages.svg=o.languages.markup,o.languages.xml=o.languages.extend("markup",{}),o.languages.ssml=o.languages.xml,o.languages.atom=o.languages.xml,o.languages.rss=o.languages.xml,function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var o=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=r.variable[1].inside,i=0;i]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},o.languages.c=o.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),o.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),o.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},o.languages.c.string],char:o.languages.c.char,comment:o.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:o.languages.c}}}}),o.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete o.languages.c.boolean,function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(o),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(o),function(e){var t,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=t,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}});var r={pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0},o={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:r,number:o,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:r,number:o})}(o),o.languages.javascript=o.languages.extend("clike",{"class-name":[o.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),o.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,o.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:o.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:o.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:o.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:o.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:o.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),o.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:o.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),o.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),o.languages.markup&&(o.languages.markup.tag.addInlined("script","javascript"),o.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),o.languages.js=o.languages.javascript,function(e){var t=e.util.clone(e.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,o=/(?:\{*\.{3}(?:[^{}]|)*\})/.source;function a(e,t){return e=e.replace(//g,(function(){return n})).replace(//g,(function(){return r})).replace(//g,(function(){return o})),RegExp(e,t)}o=a(o).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=a(/<\/?(?:[\w.:-]+(?:+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|))?|))**\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:a(//.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:a(/=/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var i=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(i).join(""):""},s=function(t){for(var n=[],r=0;r0&&n[n.length-1].tagName===i(o.content[0].content[1])&&n.pop():"/>"===o.content[o.content.length-1].content||n.push({tagName:i(o.content[0].content[1]),openedBraces:0}):n.length>0&&"punctuation"===o.type&&"{"===o.content?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&"punctuation"===o.type&&"}"===o.content?n[n.length-1].openedBraces--:a=!0),(a||"string"==typeof o)&&n.length>0&&0===n[n.length-1].openedBraces){var c=i(o);r0&&("string"==typeof t[r-1]||"plain-text"===t[r-1].type)&&(c=i(t[r-1])+c,t.splice(r-1,1),r--),t[r]=new e.Token("plain-text",c,null,c)}o.content&&"string"!=typeof o.content&&s(o.content)}};e.hooks.add("after-tokenize",(function(e){"jsx"!==e.language&&"tsx"!==e.language||s(e.tokens)}))}(o),function(e){function t(e,t){return RegExp(e.replace(//g,(function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source})),t)}e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.insertBefore("javascript","keyword",{imports:{pattern:t(/(\bimport\b\s*)(?:(?:\s*,\s*(?:\*\s*as\s+|\{[^{}]*\}))?|\*\s*as\s+|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(/(\bexport\b\s*)(?:\*(?:\s*as\s+)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:t(/(\.\s*)#?/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var n=["function","function-variable","method","method-variable","property-access"],r=0;r=p.length)return;var r=t[n];if("string"==typeof r||"string"==typeof r.content){var o=p[i],a="string"==typeof r?r:r.content,s=a.indexOf(o);if(-1!==s){++i;var c=a.substring(0,s),d=l(u[o]),f=a.substring(s+o.length),m=[];if(c&&m.push(c),m.push(d),f){var h=[f];e(h),m.push.apply(m,h)}"string"==typeof r?(t.splice.apply(t,[n,1].concat(m)),n+=m.length-1):r.content=m}}else{var b=r.content;Array.isArray(b)?e(b):e([b])}}}(d),new e.Token(r,d,"language-"+r,t)}e.languages.javascript["template-string"]=[i("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),i("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),i("svg",/\bsvg/.source),i("markdown",/\b(?:markdown|md)/.source),i("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),i("sql",/\bsql/.source),t].filter(Boolean);var d={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function p(e){return"string"==typeof e?e:Array.isArray(e)?e.map(p).join(""):p(e.content)}e.hooks.add("after-tokenize",(function(t){t.language in d&&function t(n){for(var r=0,o=n.length;r",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],o=[];/^\w+$/.test(n)||o.push(/\w+/.exec(n)[0]),"diff"===n&&o.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:o,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(o),o.languages.git={comment:/^#.*/m,deleted:/^[-\u2013].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/}},coord:/^@@.*@@$/m,"commit-sha1":/^commit \w{40}$/m},o.languages.go=o.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),o.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete o.languages.go["class-name"],o.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:o.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},o.hooks.add("after-tokenize",(function(e){if("graphql"===e.language)for(var t=e.tokens.filter((function(e){return"string"!=typeof e&&"comment"!==e.type&&"scalar"!==e.type})),n=0;n0)){var s=p(/^\{$/,/^\}$/);if(-1===s)continue;for(var c=n;c=0&&f(l,"variable-input")}}}}function u(e){return t[n+e]}function d(e,t){t=t||0;for(var n=0;n=a.length);c++){var l=s[c];if("string"==typeof l||l.content&&"string"==typeof l.content){var u=a[o],d=n.tokenStack[u],p="string"==typeof l?l:l.content,f=t(r,u),m=p.indexOf(f);if(m>-1){++o;var h=p.substring(0,m),b=new e.Token(r,e.tokenize(d,n.grammar),"language-"+r,d),g=p.substring(m+f.length),v=[];h&&v.push.apply(v,i([h])),v.push(b),g&&v.push.apply(v,i([g])),"string"==typeof l?s.splice.apply(s,[c,1].concat(v)):l.content=v}}else l.content&&i(l.content)}return s}(n.tokens)}}}})}(o),function(e){e.languages.handlebars={comment:/\{\{![\s\S]*?\}\}/,delimiter:{pattern:/^\{\{\{?|\}\}\}?$/,alias:"punctuation"},string:/(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,boolean:/\b(?:false|true)\b/,block:{pattern:/^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/,variable:/[\s\S]+/}},punctuation:/[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,variable:/[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/},e.hooks.add("before-tokenize",(function(t){e.languages["markup-templating"].buildPlaceholders(t,"handlebars",/\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g)})),e.hooks.add("after-tokenize",(function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"handlebars")})),e.languages.hbs=e.languages.handlebars}(o),o.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},o.languages.webmanifest=o.languages.json,o.languages.less=o.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),o.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}}),o.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/},function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,o=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+o+a+"(?:"+o+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+o+a+")(?:"+o+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+o+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+o+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n",quot:'"'},c=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(o),o.languages.objectivec=o.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete o.languages.objectivec["class-name"],o.languages.objc=o.languages.objectivec,o.languages.ocaml={comment:{pattern:/\(\*[\s\S]*?\*\)/,greedy:!0},char:{pattern:/'(?:[^\\\r\n']|\\(?:.|[ox]?[0-9a-f]{1,3}))'/i,greedy:!0},string:[{pattern:/"(?:\\(?:[\s\S]|\r\n)|[^\\\r\n"])*"/,greedy:!0},{pattern:/\{([a-z_]*)\|[\s\S]*?\|\1\}/,greedy:!0}],number:[/\b(?:0b[01][01_]*|0o[0-7][0-7_]*)\b/i,/\b0x[a-f0-9][a-f0-9_]*(?:\.[a-f0-9_]*)?(?:p[+-]?\d[\d_]*)?(?!\w)/i,/\b\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?\d[\d_]*)?(?!\w)/i],directive:{pattern:/\B#\w+/,alias:"property"},label:{pattern:/\B~\w+/,alias:"property"},"type-variable":{pattern:/\B'\w+/,alias:"function"},variant:{pattern:/`\w+/,alias:"symbol"},keyword:/\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/,boolean:/\b(?:false|true)\b/,"operator-like-punctuation":{pattern:/\[[<>|]|[>|]\]|\{<|>\}/,alias:"punctuation"},operator:/\.[.~]|:[=>]|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,punctuation:/;;|::|[(){}\[\].,:;#]|\b_\b/},o.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},o.languages.python["string-interpolation"].inside.interpolation.inside.rest=o.languages.python,o.languages.py=o.languages.python,o.languages.reason=o.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),o.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete o.languages.reason.function,function(e){e.languages.sass=e.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),e.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete e.languages.sass.atrule;var t=/\$[-\w]+|#\{\$[-\w]+\}/,n=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];e.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:t,operator:n}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:t,operator:n,important:e.languages.sass.important}}}),delete e.languages.sass.property,delete e.languages.sass.important,e.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})}(o),o.languages.scss=o.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),o.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),o.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),o.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),o.languages.scss.atrule.inside.rest=o.languages.scss,o.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t={pattern:/(\b\d+)(?:%|[a-z]+)/,lookbehind:!0},n={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0},r={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/\burl\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:else|for|if|return|unless)(?=\s|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,boolean:/\b(?:false|true)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],number:n,punctuation:/[{}()\[\];:,]/};r.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^\{|\}$/,alias:"punctuation"},rest:r}},r.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:r}},e.languages.stylus={"atrule-declaration":{pattern:/(^[ \t]*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:r}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:\{[^{}]*\}|\S.*|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:r}},statement:{pattern:/(^[ \t]*)(?:else|for|if|return|unless)[ \t].+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:r}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)(?!\s)[^{\r\n]*(?:;|[^{\r\n,]$(?!(?:\r?\n|\r)(?:\{|\2[ \t])))/m,lookbehind:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:r.interpolation}},rest:r}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t])))/m,lookbehind:!0,inside:{interpolation:r.interpolation,comment:r.comment,punctuation:/[{},]/}},func:r.func,string:r.string,comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0,greedy:!0},interpolation:r.interpolation,punctuation:/[{}()\[\];:.]/}}(o),function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(o),function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var n=e.languages.tsx.tag;n.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+n.pattern.source+")",n.pattern.flags),n.lookbehind=!0}(o),o.languages.wasm={comment:[/\(;[\s\S]*?;\)/,{pattern:/;;.*/,greedy:!0}],string:{pattern:/"(?:\\[\s\S]|[^"\\])*"/,greedy:!0},keyword:[{pattern:/\b(?:align|offset)=/,inside:{operator:/=/}},{pattern:/\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,inside:{punctuation:/\./}},/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/],variable:/\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,number:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,punctuation:/[()]/},function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ \t]+"+t.source+")?|"+t.source+"(?:[ \t]+"+n.source+")?)",o=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,(function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source})),a=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(e,t){t=(t||"").replace(/m/g,"")+"m";var n=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,(function(){return r})).replace(/<>/g,(function(){return e}));return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,(function(){return r}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,(function(){return r})).replace(/<>/g,(function(){return"(?:"+o+"|"+a+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(a),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(o),t.default=o},9901:function(e){e.exports&&(e.exports={core:{meta:{path:"components/prism-core.js",option:"mandatory"},core:"Core"},themes:{meta:{path:"themes/{id}.css",link:"index.html?theme={id}",exclusive:!0},prism:{title:"Default",option:"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{title:"Okaidia",owner:"ocodia"},"prism-twilight":{title:"Twilight",owner:"remybach"},"prism-coy":{title:"Coy",owner:"tshedor"},"prism-solarizedlight":{title:"Solarized Light",owner:"hectormatos2011 "},"prism-tomorrow":{title:"Tomorrow Night",owner:"Rosey"}},languages:{meta:{path:"components/prism-{id}",noCSS:!0,examplesPath:"examples/prism-{id}",addCheckAll:!0},markup:{title:"Markup",alias:["html","xml","svg","mathml","ssml","atom","rss"],aliasTitles:{html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",atom:"Atom",rss:"RSS"},option:"default"},css:{title:"CSS",option:"default",modify:"markup"},clike:{title:"C-like",option:"default"},javascript:{title:"JavaScript",require:"clike",modify:"markup",optional:"regex",alias:"js",option:"default"},abap:{title:"ABAP",owner:"dellagustin"},abnf:{title:"ABNF",owner:"RunDevelopment"},actionscript:{title:"ActionScript",require:"javascript",modify:"markup",owner:"Golmote"},ada:{title:"Ada",owner:"Lucretia"},agda:{title:"Agda",owner:"xy-ren"},al:{title:"AL",owner:"RunDevelopment"},antlr4:{title:"ANTLR4",alias:"g4",owner:"RunDevelopment"},apacheconf:{title:"Apache Configuration",owner:"GuiTeK"},apex:{title:"Apex",require:["clike","sql"],owner:"RunDevelopment"},apl:{title:"APL",owner:"ngn"},applescript:{title:"AppleScript",owner:"Golmote"},aql:{title:"AQL",owner:"RunDevelopment"},arduino:{title:"Arduino",require:"cpp",alias:"ino",owner:"dkern"},arff:{title:"ARFF",owner:"Golmote"},armasm:{title:"ARM Assembly",alias:"arm-asm",owner:"RunDevelopment"},arturo:{title:"Arturo",alias:"art",optional:["bash","css","javascript","markup","markdown","sql"],owner:"drkameleon"},asciidoc:{alias:"adoc",title:"AsciiDoc",owner:"Golmote"},aspnet:{title:"ASP.NET (C#)",require:["markup","csharp"],owner:"nauzilus"},asm6502:{title:"6502 Assembly",owner:"kzurawel"},asmatmel:{title:"Atmel AVR Assembly",owner:"cerkit"},autohotkey:{title:"AutoHotkey",owner:"aviaryan"},autoit:{title:"AutoIt",owner:"Golmote"},avisynth:{title:"AviSynth",alias:"avs",owner:"Zinfidel"},"avro-idl":{title:"Avro IDL",alias:"avdl",owner:"RunDevelopment"},awk:{title:"AWK",alias:"gawk",aliasTitles:{gawk:"GAWK"},owner:"RunDevelopment"},bash:{title:"Bash",alias:"shell",aliasTitles:{shell:"Shell"},owner:"zeitgeist87"},basic:{title:"BASIC",owner:"Golmote"},batch:{title:"Batch",owner:"Golmote"},bbcode:{title:"BBcode",alias:"shortcode",aliasTitles:{shortcode:"Shortcode"},owner:"RunDevelopment"},bicep:{title:"Bicep",owner:"johnnyreilly"},birb:{title:"Birb",require:"clike",owner:"Calamity210"},bison:{title:"Bison",require:"c",owner:"Golmote"},bnf:{title:"BNF",alias:"rbnf",aliasTitles:{rbnf:"RBNF"},owner:"RunDevelopment"},brainfuck:{title:"Brainfuck",owner:"Golmote"},brightscript:{title:"BrightScript",owner:"RunDevelopment"},bro:{title:"Bro",owner:"wayward710"},bsl:{title:"BSL (1C:Enterprise)",alias:"oscript",aliasTitles:{oscript:"OneScript"},owner:"Diversus23"},c:{title:"C",require:"clike",owner:"zeitgeist87"},csharp:{title:"C#",require:"clike",alias:["cs","dotnet"],owner:"mvalipour"},cpp:{title:"C++",require:"c",owner:"zeitgeist87"},cfscript:{title:"CFScript",require:"clike",alias:"cfc",owner:"mjclemente"},chaiscript:{title:"ChaiScript",require:["clike","cpp"],owner:"RunDevelopment"},cil:{title:"CIL",owner:"sbrl"},clojure:{title:"Clojure",owner:"troglotit"},cmake:{title:"CMake",owner:"mjrogozinski"},cobol:{title:"COBOL",owner:"RunDevelopment"},coffeescript:{title:"CoffeeScript",require:"javascript",alias:"coffee",owner:"R-osey"},concurnas:{title:"Concurnas",alias:"conc",owner:"jasontatton"},csp:{title:"Content-Security-Policy",owner:"ScottHelme"},cooklang:{title:"Cooklang",owner:"ahue"},coq:{title:"Coq",owner:"RunDevelopment"},crystal:{title:"Crystal",require:"ruby",owner:"MakeNowJust"},"css-extras":{title:"CSS Extras",require:"css",modify:"css",owner:"milesj"},csv:{title:"CSV",owner:"RunDevelopment"},cue:{title:"CUE",owner:"RunDevelopment"},cypher:{title:"Cypher",owner:"RunDevelopment"},d:{title:"D",require:"clike",owner:"Golmote"},dart:{title:"Dart",require:"clike",owner:"Golmote"},dataweave:{title:"DataWeave",owner:"machaval"},dax:{title:"DAX",owner:"peterbud"},dhall:{title:"Dhall",owner:"RunDevelopment"},diff:{title:"Diff",owner:"uranusjr"},django:{title:"Django/Jinja2",require:"markup-templating",alias:"jinja2",owner:"romanvm"},"dns-zone-file":{title:"DNS zone file",owner:"RunDevelopment",alias:"dns-zone"},docker:{title:"Docker",alias:"dockerfile",owner:"JustinBeckwith"},dot:{title:"DOT (Graphviz)",alias:"gv",optional:"markup",owner:"RunDevelopment"},ebnf:{title:"EBNF",owner:"RunDevelopment"},editorconfig:{title:"EditorConfig",owner:"osipxd"},eiffel:{title:"Eiffel",owner:"Conaclos"},ejs:{title:"EJS",require:["javascript","markup-templating"],owner:"RunDevelopment",alias:"eta",aliasTitles:{eta:"Eta"}},elixir:{title:"Elixir",owner:"Golmote"},elm:{title:"Elm",owner:"zwilias"},etlua:{title:"Embedded Lua templating",require:["lua","markup-templating"],owner:"RunDevelopment"},erb:{title:"ERB",require:["ruby","markup-templating"],owner:"Golmote"},erlang:{title:"Erlang",owner:"Golmote"},"excel-formula":{title:"Excel Formula",alias:["xlsx","xls"],owner:"RunDevelopment"},fsharp:{title:"F#",require:"clike",owner:"simonreynolds7"},factor:{title:"Factor",owner:"catb0t"},false:{title:"False",owner:"edukisto"},"firestore-security-rules":{title:"Firestore security rules",require:"clike",owner:"RunDevelopment"},flow:{title:"Flow",require:"javascript",owner:"Golmote"},fortran:{title:"Fortran",owner:"Golmote"},ftl:{title:"FreeMarker Template Language",require:"markup-templating",owner:"RunDevelopment"},gml:{title:"GameMaker Language",alias:"gamemakerlanguage",require:"clike",owner:"LiarOnce"},gap:{title:"GAP (CAS)",owner:"RunDevelopment"},gcode:{title:"G-code",owner:"RunDevelopment"},gdscript:{title:"GDScript",owner:"RunDevelopment"},gedcom:{title:"GEDCOM",owner:"Golmote"},gettext:{title:"gettext",alias:"po",owner:"RunDevelopment"},gherkin:{title:"Gherkin",owner:"hason"},git:{title:"Git",owner:"lgiraudel"},glsl:{title:"GLSL",require:"c",owner:"Golmote"},gn:{title:"GN",alias:"gni",owner:"RunDevelopment"},"linker-script":{title:"GNU Linker Script",alias:"ld",owner:"RunDevelopment"},go:{title:"Go",require:"clike",owner:"arnehormann"},"go-module":{title:"Go module",alias:"go-mod",owner:"RunDevelopment"},graphql:{title:"GraphQL",optional:"markdown",owner:"Golmote"},groovy:{title:"Groovy",require:"clike",owner:"robfletcher"},haml:{title:"Haml",require:"ruby",optional:["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],owner:"Golmote"},handlebars:{title:"Handlebars",require:"markup-templating",alias:["hbs","mustache"],aliasTitles:{mustache:"Mustache"},owner:"Golmote"},haskell:{title:"Haskell",alias:"hs",owner:"bholst"},haxe:{title:"Haxe",require:"clike",optional:"regex",owner:"Golmote"},hcl:{title:"HCL",owner:"outsideris"},hlsl:{title:"HLSL",require:"c",owner:"RunDevelopment"},hoon:{title:"Hoon",owner:"matildepark"},http:{title:"HTTP",optional:["csp","css","hpkp","hsts","javascript","json","markup","uri"],owner:"danielgtaylor"},hpkp:{title:"HTTP Public-Key-Pins",owner:"ScottHelme"},hsts:{title:"HTTP Strict-Transport-Security",owner:"ScottHelme"},ichigojam:{title:"IchigoJam",owner:"BlueCocoa"},icon:{title:"Icon",owner:"Golmote"},"icu-message-format":{title:"ICU Message Format",owner:"RunDevelopment"},idris:{title:"Idris",alias:"idr",owner:"KeenS",require:"haskell"},ignore:{title:".ignore",owner:"osipxd",alias:["gitignore","hgignore","npmignore"],aliasTitles:{gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore"}},inform7:{title:"Inform 7",owner:"Golmote"},ini:{title:"Ini",owner:"aviaryan"},io:{title:"Io",owner:"AlesTsurko"},j:{title:"J",owner:"Golmote"},java:{title:"Java",require:"clike",owner:"sherblot"},javadoc:{title:"JavaDoc",require:["markup","java","javadoclike"],modify:"java",optional:"scala",owner:"RunDevelopment"},javadoclike:{title:"JavaDoc-like",modify:["java","javascript","php"],owner:"RunDevelopment"},javastacktrace:{title:"Java stack trace",owner:"RunDevelopment"},jexl:{title:"Jexl",owner:"czosel"},jolie:{title:"Jolie",require:"clike",owner:"thesave"},jq:{title:"JQ",owner:"RunDevelopment"},jsdoc:{title:"JSDoc",require:["javascript","javadoclike","typescript"],modify:"javascript",optional:["actionscript","coffeescript"],owner:"RunDevelopment"},"js-extras":{title:"JS Extras",require:"javascript",modify:"javascript",optional:["actionscript","coffeescript","flow","n4js","typescript"],owner:"RunDevelopment"},json:{title:"JSON",alias:"webmanifest",aliasTitles:{webmanifest:"Web App Manifest"},owner:"CupOfTea696"},json5:{title:"JSON5",require:"json",owner:"RunDevelopment"},jsonp:{title:"JSONP",require:"json",owner:"RunDevelopment"},jsstacktrace:{title:"JS stack trace",owner:"sbrl"},"js-templates":{title:"JS Templates",require:"javascript",modify:"javascript",optional:["css","css-extras","graphql","markdown","markup","sql"],owner:"RunDevelopment"},julia:{title:"Julia",owner:"cdagnino"},keepalived:{title:"Keepalived Configure",owner:"dev-itsheng"},keyman:{title:"Keyman",owner:"mcdurdin"},kotlin:{title:"Kotlin",alias:["kt","kts"],aliasTitles:{kts:"Kotlin Script"},require:"clike",owner:"Golmote"},kumir:{title:"KuMir (\u041a\u0443\u041c\u0438\u0440)",alias:"kum",owner:"edukisto"},kusto:{title:"Kusto",owner:"RunDevelopment"},latex:{title:"LaTeX",alias:["tex","context"],aliasTitles:{tex:"TeX",context:"ConTeXt"},owner:"japborst"},latte:{title:"Latte",require:["clike","markup-templating","php"],owner:"nette"},less:{title:"Less",require:"css",optional:"css-extras",owner:"Golmote"},lilypond:{title:"LilyPond",require:"scheme",alias:"ly",owner:"RunDevelopment"},liquid:{title:"Liquid",require:"markup-templating",owner:"cinhtau"},lisp:{title:"Lisp",alias:["emacs","elisp","emacs-lisp"],owner:"JuanCaicedo"},livescript:{title:"LiveScript",owner:"Golmote"},llvm:{title:"LLVM IR",owner:"porglezomp"},log:{title:"Log file",optional:"javastacktrace",owner:"RunDevelopment"},lolcode:{title:"LOLCODE",owner:"Golmote"},lua:{title:"Lua",owner:"Golmote"},magma:{title:"Magma (CAS)",owner:"RunDevelopment"},makefile:{title:"Makefile",owner:"Golmote"},markdown:{title:"Markdown",require:"markup",optional:"yaml",alias:"md",owner:"Golmote"},"markup-templating":{title:"Markup templating",require:"markup",owner:"Golmote"},mata:{title:"Mata",owner:"RunDevelopment"},matlab:{title:"MATLAB",owner:"Golmote"},maxscript:{title:"MAXScript",owner:"RunDevelopment"},mel:{title:"MEL",owner:"Golmote"},mermaid:{title:"Mermaid",owner:"RunDevelopment"},mizar:{title:"Mizar",owner:"Golmote"},mongodb:{title:"MongoDB",owner:"airs0urce",require:"javascript"},monkey:{title:"Monkey",owner:"Golmote"},moonscript:{title:"MoonScript",alias:"moon",owner:"RunDevelopment"},n1ql:{title:"N1QL",owner:"TMWilds"},n4js:{title:"N4JS",require:"javascript",optional:"jsdoc",alias:"n4jsd",owner:"bsmith-n4"},"nand2tetris-hdl":{title:"Nand To Tetris HDL",owner:"stephanmax"},naniscript:{title:"Naninovel Script",owner:"Elringus",alias:"nani"},nasm:{title:"NASM",owner:"rbmj"},neon:{title:"NEON",owner:"nette"},nevod:{title:"Nevod",owner:"nezaboodka"},nginx:{title:"nginx",owner:"volado"},nim:{title:"Nim",owner:"Golmote"},nix:{title:"Nix",owner:"Golmote"},nsis:{title:"NSIS",owner:"idleberg"},objectivec:{title:"Objective-C",require:"c",alias:"objc",owner:"uranusjr"},ocaml:{title:"OCaml",owner:"Golmote"},odin:{title:"Odin",owner:"edukisto"},opencl:{title:"OpenCL",require:"c",modify:["c","cpp"],owner:"Milania1"},openqasm:{title:"OpenQasm",alias:"qasm",owner:"RunDevelopment"},oz:{title:"Oz",owner:"Golmote"},parigp:{title:"PARI/GP",owner:"Golmote"},parser:{title:"Parser",require:"markup",owner:"Golmote"},pascal:{title:"Pascal",alias:"objectpascal",aliasTitles:{objectpascal:"Object Pascal"},owner:"Golmote"},pascaligo:{title:"Pascaligo",owner:"DefinitelyNotAGoat"},psl:{title:"PATROL Scripting Language",owner:"bertysentry"},pcaxis:{title:"PC-Axis",alias:"px",owner:"RunDevelopment"},peoplecode:{title:"PeopleCode",alias:"pcode",owner:"RunDevelopment"},perl:{title:"Perl",owner:"Golmote"},php:{title:"PHP",require:"markup-templating",owner:"milesj"},phpdoc:{title:"PHPDoc",require:["php","javadoclike"],modify:"php",owner:"RunDevelopment"},"php-extras":{title:"PHP Extras",require:"php",modify:"php",owner:"milesj"},"plant-uml":{title:"PlantUML",alias:"plantuml",owner:"RunDevelopment"},plsql:{title:"PL/SQL",require:"sql",owner:"Golmote"},powerquery:{title:"PowerQuery",alias:["pq","mscript"],owner:"peterbud"},powershell:{title:"PowerShell",owner:"nauzilus"},processing:{title:"Processing",require:"clike",owner:"Golmote"},prolog:{title:"Prolog",owner:"Golmote"},promql:{title:"PromQL",owner:"arendjr"},properties:{title:".properties",owner:"Golmote"},protobuf:{title:"Protocol Buffers",require:"clike",owner:"just-boris"},pug:{title:"Pug",require:["markup","javascript"],optional:["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],owner:"Golmote"},puppet:{title:"Puppet",owner:"Golmote"},pure:{title:"Pure",optional:["c","cpp","fortran"],owner:"Golmote"},purebasic:{title:"PureBasic",require:"clike",alias:"pbfasm",owner:"HeX0R101"},purescript:{title:"PureScript",require:"haskell",alias:"purs",owner:"sriharshachilakapati"},python:{title:"Python",alias:"py",owner:"multipetros"},qsharp:{title:"Q#",require:"clike",alias:"qs",owner:"fedonman"},q:{title:"Q (kdb+ database)",owner:"Golmote"},qml:{title:"QML",require:"javascript",owner:"RunDevelopment"},qore:{title:"Qore",require:"clike",owner:"temnroegg"},r:{title:"R",owner:"Golmote"},racket:{title:"Racket",require:"scheme",alias:"rkt",owner:"RunDevelopment"},cshtml:{title:"Razor C#",alias:"razor",require:["markup","csharp"],optional:["css","css-extras","javascript","js-extras"],owner:"RunDevelopment"},jsx:{title:"React JSX",require:["markup","javascript"],optional:["jsdoc","js-extras","js-templates"],owner:"vkbansal"},tsx:{title:"React TSX",require:["jsx","typescript"]},reason:{title:"Reason",require:"clike",owner:"Golmote"},regex:{title:"Regex",owner:"RunDevelopment"},rego:{title:"Rego",owner:"JordanSh"},renpy:{title:"Ren'py",alias:"rpy",owner:"HyuchiaDiego"},rescript:{title:"ReScript",alias:"res",owner:"vmarcosp"},rest:{title:"reST (reStructuredText)",owner:"Golmote"},rip:{title:"Rip",owner:"ravinggenius"},roboconf:{title:"Roboconf",owner:"Golmote"},robotframework:{title:"Robot Framework",alias:"robot",owner:"RunDevelopment"},ruby:{title:"Ruby",require:"clike",alias:"rb",owner:"samflores"},rust:{title:"Rust",owner:"Golmote"},sas:{title:"SAS",optional:["groovy","lua","sql"],owner:"Golmote"},sass:{title:"Sass (Sass)",require:"css",optional:"css-extras",owner:"Golmote"},scss:{title:"Sass (Scss)",require:"css",optional:"css-extras",owner:"MoOx"},scala:{title:"Scala",require:"java",owner:"jozic"},scheme:{title:"Scheme",owner:"bacchus123"},"shell-session":{title:"Shell session",require:"bash",alias:["sh-session","shellsession"],owner:"RunDevelopment"},smali:{title:"Smali",owner:"RunDevelopment"},smalltalk:{title:"Smalltalk",owner:"Golmote"},smarty:{title:"Smarty",require:"markup-templating",optional:"php",owner:"Golmote"},sml:{title:"SML",alias:"smlnj",aliasTitles:{smlnj:"SML/NJ"},owner:"RunDevelopment"},solidity:{title:"Solidity (Ethereum)",alias:"sol",require:"clike",owner:"glachaud"},"solution-file":{title:"Solution file",alias:"sln",owner:"RunDevelopment"},soy:{title:"Soy (Closure Template)",require:"markup-templating",owner:"Golmote"},sparql:{title:"SPARQL",require:"turtle",owner:"Triply-Dev",alias:"rq"},"splunk-spl":{title:"Splunk SPL",owner:"RunDevelopment"},sqf:{title:"SQF: Status Quo Function (Arma 3)",require:"clike",owner:"RunDevelopment"},sql:{title:"SQL",owner:"multipetros"},squirrel:{title:"Squirrel",require:"clike",owner:"RunDevelopment"},stan:{title:"Stan",owner:"RunDevelopment"},stata:{title:"Stata Ado",require:["mata","java","python"],owner:"RunDevelopment"},iecst:{title:"Structured Text (IEC 61131-3)",owner:"serhioromano"},stylus:{title:"Stylus",owner:"vkbansal"},supercollider:{title:"SuperCollider",alias:"sclang",owner:"RunDevelopment"},swift:{title:"Swift",owner:"chrischares"},systemd:{title:"Systemd configuration file",owner:"RunDevelopment"},"t4-templating":{title:"T4 templating",owner:"RunDevelopment"},"t4-cs":{title:"T4 Text Templates (C#)",require:["t4-templating","csharp"],alias:"t4",owner:"RunDevelopment"},"t4-vb":{title:"T4 Text Templates (VB)",require:["t4-templating","vbnet"],owner:"RunDevelopment"},tap:{title:"TAP",owner:"isaacs",require:"yaml"},tcl:{title:"Tcl",owner:"PeterChaplin"},tt2:{title:"Template Toolkit 2",require:["clike","markup-templating"],owner:"gflohr"},textile:{title:"Textile",require:"markup",optional:"css",owner:"Golmote"},toml:{title:"TOML",owner:"RunDevelopment"},tremor:{title:"Tremor",alias:["trickle","troy"],owner:"darach",aliasTitles:{trickle:"trickle",troy:"troy"}},turtle:{title:"Turtle",alias:"trig",aliasTitles:{trig:"TriG"},owner:"jakubklimek"},twig:{title:"Twig",require:"markup-templating",owner:"brandonkelly"},typescript:{title:"TypeScript",require:"javascript",optional:"js-templates",alias:"ts",owner:"vkbansal"},typoscript:{title:"TypoScript",alias:"tsconfig",aliasTitles:{tsconfig:"TSConfig"},owner:"dkern"},unrealscript:{title:"UnrealScript",alias:["uscript","uc"],owner:"RunDevelopment"},uorazor:{title:"UO Razor Script",owner:"jaseowns"},uri:{title:"URI",alias:"url",aliasTitles:{url:"URL"},owner:"RunDevelopment"},v:{title:"V",require:"clike",owner:"taggon"},vala:{title:"Vala",require:"clike",optional:"regex",owner:"TemplarVolk"},vbnet:{title:"VB.Net",require:"basic",owner:"Bigsby"},velocity:{title:"Velocity",require:"markup",owner:"Golmote"},verilog:{title:"Verilog",owner:"a-rey"},vhdl:{title:"VHDL",owner:"a-rey"},vim:{title:"vim",owner:"westonganger"},"visual-basic":{title:"Visual Basic",alias:["vb","vba"],aliasTitles:{vba:"VBA"},owner:"Golmote"},warpscript:{title:"WarpScript",owner:"RunDevelopment"},wasm:{title:"WebAssembly",owner:"Golmote"},"web-idl":{title:"Web IDL",alias:"webidl",owner:"RunDevelopment"},wiki:{title:"Wiki markup",require:"markup",owner:"Golmote"},wolfram:{title:"Wolfram language",alias:["mathematica","nb","wl"],aliasTitles:{mathematica:"Mathematica",nb:"Mathematica Notebook"},owner:"msollami"},wren:{title:"Wren",owner:"clsource"},xeora:{title:"Xeora",require:"markup",alias:"xeoracube",aliasTitles:{xeoracube:"XeoraCube"},owner:"freakmaxi"},"xml-doc":{title:"XML doc (.net)",require:"markup",modify:["csharp","fsharp","vbnet"],owner:"RunDevelopment"},xojo:{title:"Xojo (REALbasic)",owner:"Golmote"},xquery:{title:"XQuery",require:"markup",owner:"Golmote"},yaml:{title:"YAML",alias:"yml",owner:"hason"},yang:{title:"YANG",owner:"RunDevelopment"},zig:{title:"Zig",owner:"RunDevelopment"}},plugins:{meta:{path:"plugins/{id}/prism-{id}",link:"plugins/{id}/"},"line-highlight":{title:"Line Highlight",description:"Highlights specific lines and/or line ranges."},"line-numbers":{title:"Line Numbers",description:"Line number at the beginning of code lines.",owner:"kuba-kubula"},"show-invisibles":{title:"Show Invisibles",description:"Show hidden characters such as tabs and line breaks.",optional:["autolinker","data-uri-highlight"]},autolinker:{title:"Autolinker",description:"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},wpd:{title:"WebPlatform Docs",description:'Makes tokens link to WebPlatform.org documentation. The links open in a new tab.'},"custom-class":{title:"Custom Class",description:"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.",owner:"dvkndn",noCSS:!0},"file-highlight":{title:"File Highlight",description:"Fetch external files and highlight them with Prism. Used on the Prism website itself.",noCSS:!0},"show-language":{title:"Show Language",description:"Display the highlighted language in code blocks (inline code does not show the label).",owner:"nauzilus",noCSS:!0,require:"toolbar"},"jsonp-highlight":{title:"JSONP Highlight",description:"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).",noCSS:!0,owner:"nauzilus"},"highlight-keywords":{title:"Highlight Keywords",description:"Adds special CSS classes for each keyword for fine-grained highlighting.",owner:"vkbansal",noCSS:!0},"remove-initial-line-feed":{title:"Remove initial line feed",description:"Removes the initial line feed in code blocks.",owner:"Golmote",noCSS:!0},"inline-color":{title:"Inline color",description:"Adds a small inline preview for colors in style sheets.",require:"css-extras",owner:"RunDevelopment"},previewers:{title:"Previewers",description:"Previewers for angles, colors, gradients, easing and time.",require:"css-extras",owner:"Golmote"},autoloader:{title:"Autoloader",description:"Automatically loads the needed languages to highlight the code blocks.",owner:"Golmote",noCSS:!0},"keep-markup":{title:"Keep Markup",description:"Prevents custom markup from being dropped out during highlighting.",owner:"Golmote",optional:"normalize-whitespace",noCSS:!0},"command-line":{title:"Command Line",description:"Display a command line with a prompt and, optionally, the output/response from the commands.",owner:"chriswells0"},"unescaped-markup":{title:"Unescaped Markup",description:"Write markup without having to escape anything."},"normalize-whitespace":{title:"Normalize Whitespace",description:"Supports multiple operations to normalize whitespace in code blocks.",owner:"zeitgeist87",optional:"unescaped-markup",noCSS:!0},"data-uri-highlight":{title:"Data-URI Highlight",description:"Highlights data-URI contents.",owner:"Golmote",noCSS:!0},toolbar:{title:"Toolbar",description:"Attach a toolbar for plugins to easily register buttons on the top of a code block.",owner:"mAAdhaTTah"},"copy-to-clipboard":{title:"Copy to Clipboard Button",description:"Add a button that copies the code block to the clipboard when clicked.",owner:"mAAdhaTTah",require:"toolbar",noCSS:!0},"download-button":{title:"Download Button",description:"A button in the toolbar of a code block adding a convenient way to download a code file.",owner:"Golmote",require:"toolbar",noCSS:!0},"match-braces":{title:"Match braces",description:"Highlights matching braces.",owner:"RunDevelopment"},"diff-highlight":{title:"Diff Highlight",description:"Highlights the code inside diff blocks.",owner:"RunDevelopment",require:"diff"},"filter-highlight-all":{title:"Filter highlightAll",description:"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.",owner:"RunDevelopment",noCSS:!0},treeview:{title:"Treeview",description:"A language with special styles to highlight file system tree structures.",owner:"Golmote"}}})},2885:function(e,t,n){const r=n(9901),o=n(9642),a=new Set;function i(e){void 0===e?e=Object.keys(r.languages).filter((e=>"meta"!=e)):Array.isArray(e)||(e=[e]);const t=[...a,...Object.keys(Prism.languages)];o(r,e,t).load((e=>{if(!(e in r.languages))return void(i.silent||console.warn("Language does not exist: "+e));const t="./prism-"+e;delete n.c[n(6500).resolve(t)],delete Prism.languages[e],n(6500)(t),a.add(e)}))}i.silent=!1,e.exports=i},6726:function(e,t,n){var r={"./":2885};function o(e){var t=a(e);return n(t)}function a(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}o.keys=function(){return Object.keys(r)},o.resolve=a,e.exports=o,o.id=6726},6500:function(e,t,n){var r={"./":2885};function o(e){var t=a(e);return n(t)}function a(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}o.keys=function(){return Object.keys(r)},o.resolve=a,e.exports=o,o.id=6500},9642:function(e){"use strict";var t=function(){var e=function(){};function t(e,t){Array.isArray(e)?e.forEach(t):null!=e&&t(e,0)}function n(e){for(var t={},n=0,r=e.length;n "));var s={},c=e[r];if(c){function l(t){if(!(t in e))throw new Error(r+" depends on an unknown component "+t);if(!(t in s))for(var i in o(t,a),s[t]=!0,n[t])s[i]=!0}t(c.require,l),t(c.optional,l),t(c.modify,l)}n[r]=s,a.pop()}}return function(e){var t=n[e];return t||(o(e,r),t=n[e]),t}}function o(e){for(var t in e)return!0;return!1}return function(a,i,s){var c=function(e){var t={};for(var n in e){var r=e[n];for(var o in r)if("meta"!=o){var a=r[o];t[o]="string"==typeof a?{title:a}:a}}return t}(a),l=function(e){var n;return function(r){if(r in e)return r;if(!n)for(var o in n={},e){var a=e[o];t(a&&a.alias,(function(t){if(t in n)throw new Error(t+" cannot be alias for both "+o+" and "+n[t]);if(t in e)throw new Error(t+" cannot be alias of "+o+" because it is a component.");n[t]=o}))}return n[r]||r}}(c);i=i.map(l),s=(s||[]).map(l);var u=n(i),d=n(s);i.forEach((function e(n){var r=c[n];t(r&&r.require,(function(t){t in d||(u[t]=!0,e(t))}))}));for(var p,f=r(c),m=u;o(m);){for(var h in p={},m){var b=c[h];t(b&&b.modify,(function(e){e in d&&(p[e]=!0)}))}for(var g in d)if(!(g in u))for(var v in f(g))if(v in u){p[g]=!0;break}for(var y in m=p)u[y]=!0}var w={getIds:function(){var e=[];return w.load((function(t){e.push(t)})),e},load:function(t,n){return function(t,n,r,o){var a=o?o.series:void 0,i=o?o.parallel:e,s={},c={};function l(e){if(e in s)return s[e];c[e]=!0;var o,u=[];for(var d in t(e))d in n&&u.push(d);if(0===u.length)o=r(e);else{var p=i(u.map((function(e){var t=l(e);return delete c[e],t})));a?o=a(p,(function(){return r(e)})):r(e)}return s[e]=o}for(var u in n)l(u);var d=[];for(var p in c)d.push(s[p]);return i(d)}(f,u,t,n)}};return w}}();e.exports=t},2703:function(e,t,n){"use strict";var r=n(414);function o(){}function a(){}a.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,a,i){if(i!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:o};return n.PropTypes=n,n}},5697:function(e,t,n){e.exports=n(2703)()},414:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4448:function(e,t,n){"use strict";var r=n(7294),o=n(7418),a=n(3840);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n