diff options
-rw-r--r-- | src/index.js | 3 | ||||
-rw-r--r-- | src/js/agl_stubs_mediaplayer.js | 49 | ||||
-rw-r--r-- | src/js/app.js | 2 | ||||
-rw-r--r-- | src/js/player.js | 2 | ||||
-rw-r--r-- | src/js/playlist.js | 2 | ||||
-rw-r--r-- | src/js/templates.js | 4 |
6 files changed, 53 insertions, 9 deletions
diff --git a/src/index.js b/src/index.js index f1644ae..9ad7774 100644 --- a/src/index.js +++ b/src/index.js @@ -18,13 +18,10 @@ import * as app from './js/app'; import * as player from './js/player'; import * as playlist from './js/playlist'; -import { api } from 'agl-js-api'; - /* CSS */ import './styles/app.scss'; window.player = player; window.playlist = playlist; -api.init(); app.init(); diff --git a/src/js/agl_stubs_mediaplayer.js b/src/js/agl_stubs_mediaplayer.js new file mode 100644 index 0000000..ef26f23 --- /dev/null +++ b/src/js/agl_stubs_mediaplayer.js @@ -0,0 +1,49 @@ +export function on_metadata_changes() { +} + +export function on_playlist_changes() { +} + +export function loop() { + return new Promise((resolve, reject) => { + resolve(); + }); +} + +export function pickTrack() { +} + +export function play() { + return new Promise((resolve, reject) => { + resolve(); + }); +} + +export function pause() { +} + +export function previous() { +} + +export function next() { +} + +export function seek() { +} + +function get_test_playlist() { + return { + playlist: [ + { index: 1, title: "Title 1", genre: "Genre 1", artist: "Artist 1"}, + { index: 2, title: "Title 2", genre: "Genre 2", artist: "Artist 2"}, + { index: 3, title: "Title 3", genre: "Genre 3", artist: "Artist 3"}, + { index: 4, title: "Title 4", genre: "Genre 4", artist: "Artist 4"}, + ] + }; +} + +export function playlist() { + return new Promise((resolve, reject) => { + resolve(get_test_playlist()); + }); +} diff --git a/src/js/app.js b/src/js/app.js index 2e53754..40be774 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -3,8 +3,6 @@ import * as player from './player'; import * as playlist from './playlist'; import Mustache from 'mustache'; -import { mediaplayer } from 'agl-js-api'; - var template; var page = { diff --git a/src/js/player.js b/src/js/player.js index 3fc34c7..b3e8173 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -1,7 +1,7 @@ import { load as load_template } from './templates'; import Mustache from 'mustache'; -import { mediaplayer } from 'agl-js-api'; +import * as mediaplayer from './agl_stubs_mediaplayer'; var template; var root; diff --git a/src/js/playlist.js b/src/js/playlist.js index 4739efc..0536816 100644 --- a/src/js/playlist.js +++ b/src/js/playlist.js @@ -1,7 +1,7 @@ import { load as load_template } from './templates'; import Mustache from 'mustache'; -import { mediaplayer } from 'agl-js-api'; +import * as mediaplayer from './agl_stubs_mediaplayer'; var template; var root; diff --git a/src/js/templates.js b/src/js/templates.js index 2513722..4b71638 100644 --- a/src/js/templates.js +++ b/src/js/templates.js @@ -2,12 +2,12 @@ export function load(template) { return new Promise(function(resolve, reject){ var xhr = new XMLHttpRequest(); - xhr.open('GET', '/templates/'+template); + xhr.open('GET', './templates/'+template); xhr.send(); xhr.onload = function() { - if (xhr.status != 200) { + if (xhr.status != 200 && xhr.status != 0) { console.error('Error loading template', xhr.status, xhr.statusText); reject(xhr.status); } else { |