* Integrates soundcloud

* adds music

Signed-off-by: Indrajith K L <mac91112@gmail.com>
This commit is contained in:
Indrajith K L
2018-07-31 13:01:18 +05:30
parent f5d056bb65
commit dc891701a3
3 changed files with 28 additions and 2 deletions

5
package-lock.json generated
View File

@@ -6398,6 +6398,11 @@
"is-plain-obj": "1.1.0" "is-plain-obj": "1.1.0"
} }
}, },
"soundcloud-audio": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/soundcloud-audio/-/soundcloud-audio-1.3.1.tgz",
"integrity": "sha512-7VMyxAR3vQreRcK/RH+oM19hUr6obwxeiL42/nR5L3u2NXp82RvEdfJc5lq/mq0C3zA+gi6jcHkUIu8lFYwLIg=="
},
"source-map": { "source-map": {
"version": "0.5.7", "version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",

View File

@@ -18,6 +18,7 @@
"react": "^16.4.1", "react": "^16.4.1",
"react-dom": "^16.4.1", "react-dom": "^16.4.1",
"react-render-html": "^0.6.0", "react-render-html": "^0.6.0",
"soundcloud-audio": "^1.3.1",
"vex-js": "^4.1.0" "vex-js": "^4.1.0"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -2,6 +2,7 @@ import React, { Component } from 'react';
import axios from 'axios'; import axios from 'axios';
import PawnedListItem from './PawnedListItem'; import PawnedListItem from './PawnedListItem';
import './SearchField.css'; import './SearchField.css';
import SoundCloudAudio from 'soundcloud-audio';
export default class SearchField extends Component { export default class SearchField extends Component {
@@ -20,6 +21,8 @@ export default class SearchField extends Component {
this.checkIsPawned = this.checkIsPawned.bind(this); this.checkIsPawned = this.checkIsPawned.bind(this);
this.breachItems = []; this.breachItems = [];
this.displayMessage; this.displayMessage;
this.musicPlayer = new SoundCloudAudio('1b0ff6d5c4606e7fdf5d744be591b5a4');
console.log(SoundCloudAudio);
} }
render() { render() {
@@ -36,7 +39,7 @@ export default class SearchField extends Component {
<div className="searchWrapper"> <div className="searchWrapper">
<div className="search"> <div className="search">
<div className="title"> <div className="title">
<label class="hover-field glitch-text" data-text="isPawned"> <label className="hover-field glitch-text" data-text="isPawned">
isPawned isPawned
<span>Check wheather your email address is Pawned anywhere</span> <span>Check wheather your email address is Pawned anywhere</span>
</label> </label>
@@ -50,11 +53,28 @@ export default class SearchField extends Component {
</div> </div>
<div className="searchResults"> <div className="searchResults">
{this.breachItems} {this.breachItems}
</div> </div>
</div> </div>
); );
} }
componentDidMount() {
this.musicPlayer.stop(); // fallback
if (!this.musicPlayer.playing) {
this.musicPlayer.resolve('https://soundcloud.com/djangodjango/first-light', (playlist) => {
console.log(playlist);
this.musicPlayer.play();
this.musicPlayer.on('ended', () => {
this.musicPlayer.play();
});
});
}
}
onFocus(e) { onFocus(e) {
if (e.target.classList.contains('pulse')) { if (e.target.classList.contains('pulse')) {
e.target.classList.remove('pulse'); e.target.classList.remove('pulse');