Repository: spotify/spotify-web-playback-sdk-example
Branch: main
Commit: d22700174073
Files: 17
Total size: 26.2 KB
Directory structure:
gitextract_zz6ucqgh/
├── .gitignore
├── LICENSE
├── README.md
├── catalog-info.yaml
├── package.json
├── public/
│ ├── index.html
│ ├── manifest.json
│ └── robots.txt
├── server/
│ └── index.js
└── src/
├── App.css
├── App.js
├── App.test.js
├── Login.js
├── WebPlayback.jsx
├── index.css
├── index.js
└── setupProxy.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# React compiled files
build
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2012-2016 Spotify AB
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
# Web Playback SDK Javascript Tutorial
This repository contains the source code for the [Web Playback SDK Guide](https://developer.spotify.com/documentation/web-playback-sdk/guide/).
## Using your own credentials
You will need to register your app and get your own credentials from the
[Spotify for Developers Dashboard](https://developer.spotify.com/dashboard/)
To do so, go to your Spotify for Developers Dashboard, create your
application and register the following callback URI:
`http://localhost:3000/auth/callback`
Once you have created your app, create a file called `.env` in the root folder
of the repository with your Spotify credentials:
```bash
SPOTIFY_CLIENT_ID='my_client_id'
SPOTIFY_CLIENT_SECRET='my_client_secret'
```
## Installation
These examples run on Node.js. On its
[website](http://www.nodejs.org/download/) you can find instructions on how to
install it.
Once installed, clone the repository and install its dependencies running:
```bash
npm install
```
## Running the example
Start both client and server with the following command:
```bash
npm run dev
```
The React application will start on `http://localhost:3000`
## Resources
- Follow [@SpotifyPlatform](https://twitter.com/SpotifyPlatform) on Twitter for Spotify for Developers updates.
- Join the [Spotify for Developers Community Forum](https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer).
## Code of Conduct
This project adheres to the [Open Source Code of
Conduct](https://github.com/spotify/code-of-conduct/blob/master/code-of-conduct.md).
By participating, you are expected to honor this code.
## License
Copyright 2021 Spotify AB.
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
================================================
FILE: catalog-info.yaml
================================================
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: spotify-web-playback-sdk-example
spec:
type: library
owner: opx-partner-activation
================================================
FILE: package.json
================================================
{
"name": "web-playback-sdk-sample-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"server": "node server",
"dev": "run-p server start"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"dotenv": "^10.0.0",
"express": "^4.17.1",
"http-proxy-middleware": "^2.0.0",
"npm-run-all": "^4.1.5",
"request": "^2.88.2"
}
}
================================================
FILE: public/index.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
================================================
FILE: public/manifest.json
================================================
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
================================================
FILE: public/robots.txt
================================================
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
================================================
FILE: server/index.js
================================================
const express = require('express')
const request = require('request');
const dotenv = require('dotenv');
const port = 5000
global.access_token = ''
dotenv.config()
var spotify_client_id = process.env.SPOTIFY_CLIENT_ID
var spotify_client_secret = process.env.SPOTIFY_CLIENT_SECRET
var spotify_redirect_uri = 'http://localhost:3000/auth/callback'
var generateRandomString = function (length) {
var text = '';
var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (var i = 0; i < length; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
};
var app = express();
app.get('/auth/login', (req, res) => {
var scope = "streaming user-read-email user-read-private"
var state = generateRandomString(16);
var auth_query_parameters = new URLSearchParams({
response_type: "code",
client_id: spotify_client_id,
scope: scope,
redirect_uri: spotify_redirect_uri,
state: state
})
res.redirect('https://accounts.spotify.com/authorize/?' + auth_query_parameters.toString());
})
app.get('/auth/callback', (req, res) => {
var code = req.query.code;
var authOptions = {
url: 'https://accounts.spotify.com/api/token',
form: {
code: code,
redirect_uri: spotify_redirect_uri,
grant_type: 'authorization_code'
},
headers: {
'Authorization': 'Basic ' + (Buffer.from(spotify_client_id + ':' + spotify_client_secret).toString('base64')),
'Content-Type' : 'application/x-www-form-urlencoded'
},
json: true
};
request.post(authOptions, function(error, response, body) {
if (!error && response.statusCode === 200) {
access_token = body.access_token;
res.redirect('/')
}
});
})
app.get('/auth/token', (req, res) => {
res.json({ access_token: access_token})
})
app.listen(port, () => {
console.log(`Listening at http://localhost:${port}`)
})
================================================
FILE: src/App.css
================================================
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
height: 100%;
}
body {
background-color: #333;
color: #eee;
font-family: Helvetica, Arial;
font-size: 3vmin;
}
.App {
text-align: center;
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.hidden {
display: none;
}
.background {
left: 0;
right: 0;
top: 0;
bottom: 0;
background-size: cover;
background-position: center center;
/*filter: blur(8em) opacity(0.6);*/
position: absolute;
}
.main-wrapper {
padding-top: 45px;
align-items: center;
display: flex;
height: 100%;
margin: 0 auto;
justify-content: center;
position: relative;
width: 80%;
z-index: 1;
}
.container {
align-items: center;
display: flex;
justify-content: center;
height: 100%;
}
.main-container {
flex: 1;
}
.now-playing__name {
font-size: 1.5em;
margin-bottom: 0.2em;
}
.now-playing__artist {
margin-bottom: 1em;
}
.now-playing__status {
margin-bottom: 1em;
}
.now-playing__cover {
border-radius: 8px;
float: left;
margin-right: 10px;
text-align: right;
width: 300px;
height: 300px;
}
.now-playing__side {
margin-left: 2%;
width: 45%;
}
.btn-spotify {
background-color:#44c767;
border-radius:28px;
border:1px solid #18ab29;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:Arial;
font-size:17px;
padding:16px 31px;
text-decoration:none;
text-shadow:0px 1px 0px #2f6627;
}
.btn-spotify:active {
position:relative;
top:1px;
}
img { background: transparent; }
================================================
FILE: src/App.js
================================================
import React, { useState, useEffect } from 'react';
import WebPlayback from './WebPlayback'
import Login from './Login'
import './App.css';
function App() {
const [token, setToken] = useState('');
useEffect(() => {
async function getToken() {
const response = await fetch('/auth/token');
const json = await response.json();
setToken(json.access_token);
}
getToken();
}, []);
return (
<>
{ (token === '') ? <Login/> : <WebPlayback token={token} /> }
</>
);
}
export default App;
================================================
FILE: src/App.test.js
================================================
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
================================================
FILE: src/Login.js
================================================
import React from 'react';
function Login() {
return (
<div className="App">
<header className="App-header">
<a className="btn-spotify" href="/auth/login" >
Login with Spotify
</a>
</header>
</div>
);
}
export default Login;
================================================
FILE: src/WebPlayback.jsx
================================================
import React, { useState, useEffect } from 'react';
const track = {
name: "",
album: {
images: [
{ url: "" }
]
},
artists: [
{ name: "" }
]
}
function WebPlayback(props) {
const [is_paused, setPaused] = useState(false);
const [is_active, setActive] = useState(false);
const [player, setPlayer] = useState(undefined);
const [current_track, setTrack] = useState(track);
useEffect(() => {
const script = document.createElement("script");
script.src = "https://sdk.scdn.co/spotify-player.js";
script.async = true;
document.body.appendChild(script);
window.onSpotifyWebPlaybackSDKReady = () => {
const player = new window.Spotify.Player({
name: 'Web Playback SDK',
getOAuthToken: cb => { cb(props.token); },
volume: 0.5
});
setPlayer(player);
player.addListener('ready', ({ device_id }) => {
console.log('Ready with Device ID', device_id);
});
player.addListener('not_ready', ({ device_id }) => {
console.log('Device ID has gone offline', device_id);
});
player.addListener('player_state_changed', ( state => {
if (!state) {
return;
}
setTrack(state.track_window.current_track);
setPaused(state.paused);
player.getCurrentState().then( state => {
(!state)? setActive(false) : setActive(true)
});
}));
player.connect();
};
}, []);
if (!is_active) {
return (
<>
<div className="container">
<div className="main-wrapper">
<b> Instance not active. Transfer your playback using your Spotify app </b>
</div>
</div>
</>)
} else {
return (
<>
<div className="container">
<div className="main-wrapper">
<img src={current_track.album.images[0].url} className="now-playing__cover" alt="" />
<div className="now-playing__side">
<div className="now-playing__name">{current_track.name}</div>
<div className="now-playing__artist">{current_track.artists[0].name}</div>
<button className="btn-spotify" onClick={() => { player.previousTrack() }} >
<<
</button>
<button className="btn-spotify" onClick={() => { player.togglePlay() }} >
{ is_paused ? "PLAY" : "PAUSE" }
</button>
<button className="btn-spotify" onClick={() => { player.nextTrack() }} >
>>
</button>
</div>
</div>
</div>
</>
);
}
}
export default WebPlayback
================================================
FILE: src/index.css
================================================
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
================================================
FILE: src/index.js
================================================
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './index.css';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
================================================
FILE: src/setupProxy.js
================================================
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function (app) {
app.use('/auth/**',
createProxyMiddleware({
target: 'http://localhost:5000'
})
);
};
gitextract_zz6ucqgh/
├── .gitignore
├── LICENSE
├── README.md
├── catalog-info.yaml
├── package.json
├── public/
│ ├── index.html
│ ├── manifest.json
│ └── robots.txt
├── server/
│ └── index.js
└── src/
├── App.css
├── App.js
├── App.test.js
├── Login.js
├── WebPlayback.jsx
├── index.css
├── index.js
└── setupProxy.js
SYMBOL INDEX (3 symbols across 3 files)
FILE: src/App.js
function App (line 6) | function App() {
FILE: src/Login.js
function Login (line 3) | function Login() {
FILE: src/WebPlayback.jsx
function WebPlayback (line 15) | function WebPlayback(props) {
Condensed preview — 17 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (29K chars).
[
{
"path": ".gitignore",
"chars": 1640,
"preview": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n\n# Diagnostic reports (https://nodejs."
},
{
"path": "LICENSE",
"chars": 11345,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 1761,
"preview": "# Web Playback SDK Javascript Tutorial\n\nThis repository contains the source code for the [Web Playback SDK Guide](https:"
},
{
"path": "catalog-info.yaml",
"chars": 155,
"preview": "apiVersion: backstage.io/v1alpha1\nkind: Component\nmetadata:\n name: spotify-web-playback-sdk-example\nspec:\n type: libra"
},
{
"path": "package.json",
"chars": 815,
"preview": "{\n \"name\": \"web-playback-sdk-sample-app\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"dependencies\": {\n \"react\": \"^1"
},
{
"path": "public/index.html",
"chars": 1721,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <link rel=\"icon\" href=\"%PUBLIC_URL%/favicon.i"
},
{
"path": "public/manifest.json",
"chars": 492,
"preview": "{\n \"short_name\": \"React App\",\n \"name\": \"Create React App Sample\",\n \"icons\": [\n {\n \"src\": \"favicon.ico\",\n "
},
{
"path": "public/robots.txt",
"chars": 67,
"preview": "# https://www.robotstxt.org/robotstxt.html\nUser-agent: *\nDisallow:\n"
},
{
"path": "server/index.js",
"chars": 1932,
"preview": "const express = require('express')\nconst request = require('request');\nconst dotenv = require('dotenv');\n\nconst port = 5"
},
{
"path": "src/App.css",
"chars": 1699,
"preview": "* {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n}\n\nhtml, body {\n height: 100%;\n}\n\nbody {\n background-color: #"
},
{
"path": "src/App.js",
"chars": 543,
"preview": "import React, { useState, useEffect } from 'react';\nimport WebPlayback from './WebPlayback'\nimport Login from './Login'\n"
},
{
"path": "src/App.test.js",
"chars": 246,
"preview": "import { render, screen } from '@testing-library/react';\nimport App from './App';\n\ntest('renders learn react link', () ="
},
{
"path": "src/Login.js",
"chars": 329,
"preview": "import React from 'react';\n\nfunction Login() {\n return (\n <div className=\"App\">\n <header className="
},
{
"path": "src/WebPlayback.jsx",
"chars": 3247,
"preview": "import React, { useState, useEffect } from 'react';\n\nconst track = {\n name: \"\",\n album: {\n images: [\n "
},
{
"path": "src/index.css",
"chars": 366,
"preview": "body {\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n 'Ubuntu', 'Can"
},
{
"path": "src/index.js",
"chars": 219,
"preview": "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from './App';\nimport './index.css';\n\nReactDOM.re"
},
{
"path": "src/setupProxy.js",
"chars": 226,
"preview": "const { createProxyMiddleware } = require('http-proxy-middleware');\n\nmodule.exports = function (app) {\n app.use('/aut"
}
]
About this extraction
This page contains the full source code of the spotify/spotify-web-playback-sdk-example GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 17 files (26.2 KB), approximately 6.5k tokens, and a symbol index with 3 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.