cassette icon indicating copy to clipboard operation
cassette copied to clipboard

Create several example applications

Open benwiley4000 opened this issue 6 years ago • 1 comments

I'd like to demonstrate several ways to use Cassette. What I have in mind at the moment is:

  • [ ] A playlist-oriented music library application (like Spotify or iTunes)
  • [ ] A playlist-oriented video library application (like Netflix or YouTube)
  • [ ] A social media ish page with multiple concurrent videos
  • [ ] A live media streaming application (like Twitch or iHeartRadio)

Anyone who wants to help me with this is more than welcome! :smiley:

benwiley4000 avatar Feb 18 '19 16:02 benwiley4000

For media content we can use this code to get JSON search data from archive.org:

function getArchiveSearchUrl(mediatype, { search, fields, page, pageSize }) {
  return (
	`https://archive.org/advancedsearch.php?q=` +
    `${search}+AND+mediatype:${mediatype}&fl[]=${fields}` +
    `&rows=${pageSize}&page=${page}&output=json`
  );
}

const search = 'Computer games';
const fields = '*'; // (can be like 'name,genre')
const page = 1;
const pageSize = 15;

// search for video
fetch(getArchiveSearchUrl('movies', { search, fields, page, pageSize }))
  .then(res => res.json()).then(res => console.log(res.response.docs)); 

// search for audio
fetch(getArchiveSearchUrl('audio', { search, fields, page, pageSize }))
  .then(res => res.json()).then(res => console.log(res.response.docs));

Unfortunately that API doesn't yet have adequate CORS headers for access from a browser so we may need to run a proxy server.

benwiley4000 avatar Feb 23 '19 22:02 benwiley4000