Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ReferenceError: DrmStreamingPlayer is not defined #14

Open
iaiqbal opened this issue Apr 13, 2019 · 10 comments
Open

Uncaught ReferenceError: DrmStreamingPlayer is not defined #14

iaiqbal opened this issue Apr 13, 2019 · 10 comments

Comments

@iaiqbal
Copy link

iaiqbal commented Apr 13, 2019

I am experiencing the following error in the console. I'm following the API documentation as described in the readme. I've tried basic fixes like moving the code around in certain areas of the HTML, a script.js and in the actual napster.min.js. I've isolated the conflict to the .set method. "napster.min.js:15" refers to "Napster.member.set({.....".

napster.min.js:4 Uncaught ReferenceError: DrmStreamingPlayer is not defined
    at e.auth (napster.min.js:4)
    at l.<anonymous> (napster.min.js:4)
    at l.a.(anonymous function) [as set] (file:///C:/Users/Ibrahim%20Iqbal/Desktop/Bootcamp%20Homework/Project-1/assets/javascript/napster.min.js:4:6296)
    at napster.min.js:15
Napster.init({
    consumerKey: 'ZTk2YjY4MjMtMDAzYy00MTg4LWE2MjYtZDIzNjJmMmM0YTdm',
    isHTML5Compatible: true,
    version: 'v2.1',
    player: 'player-frame'
    // player: "aside"
});

Napster.member.set({
    accessToken: 'oauth access token',
    refreshToken: 'oauth refresh token'
});

Napster.player.on('ready', function (e) {
    Napster.member.set({ accessToken: 'oauth access token' }); // If not set earlier
    Napster.player.auth();
});


Napster.player.play('tra.313617399');



Has this been deprecated by any chance?

@eltmon
Copy link

eltmon commented Apr 13, 2019 via email

@iaiqbal
Copy link
Author

iaiqbal commented Apr 14, 2019

So after doing that, without actually moving the hard code around and the Napster initialization written out in the in napster.min.js file after the pre-written code, I still get the same error as above(DrmStreamingPlayer is not defined).

However, moving the initialization code into my index.html into a script tag at the end of the body will give me the following error:

index.html:1 GET https://api.napster.com/v2.2/tracks/tra.361046974 401 (Unauthorized)

Uncaught (in promise) SyntaxError: Unexpected token E in JSON at position 0 at JSON.parse (<anonymous>) at streaming-player.js:10

streaming-player.js?_=1555255466309:27 VIDEOJS: WARN: Player "napster-streaming-player" is already initialised. Options will not be applied.

@eltmon
Copy link

eltmon commented Apr 14, 2019 via email

@iaiqbal
Copy link
Author

iaiqbal commented Apr 14, 2019

I have the API key linked in an AJAX call in my script.js. This is the code:

`//query napster for top playlist
const playlistQueryUrl = "https://api.napster.com/v2.2/tracks/top?apikey=ZTk2YjY4MjMtMDAzYy00MTg4LWE2MjYtZDIzNjJmMmM0YTdm"
// const playlistQueryUrl = "https://api.napster.com/v2.0/tracks/top?apikey=ZTk2YjY4MjMtMDAzYy00MTg4LWE2MjYtZDIzNjJmMmM0YTdm"

$.ajax({
url: playlistQueryUrl,
method: "GET"
}).then(function(response){
trackDetails = response;
console.log("this is what napster returns", response);
console.log("mp3 link", response.tracks[0].previewURL);
});`

@iaiqbal
Copy link
Author

iaiqbal commented Apr 14, 2019

The second const is commented out. I'm sorry, I'm not sure why it isn't creating a code snippet of it all.

@eltmon
Copy link

eltmon commented Apr 14, 2019 via email

@iaiqbal
Copy link
Author

iaiqbal commented Apr 14, 2019

That would be fantastic. Unfortunately I have work soon but I'd like to talk through it. This is a group project I'm working on so perhaps my teammates would be able to chime in. I've provided them the code and the link to this page so you could be hearing something from them as well.

@apizarras
Copy link

Hi Ed, I am a project teammate of Ibrahim's and can get on a discord call with you later this afternoon if you have availability. Would you be available sometime after 4PM Mountain Time?

@eltmon
Copy link

eltmon commented Apr 14, 2019 via email

@cleio
Copy link
Contributor

cleio commented Apr 19, 2019

Hi @iaiqbal!
Thank you for reporting this issue! In case you did not resolve it, can you please send following info:

  • which browser you are using to test
  • are you using example app to test
  • if you don't mind, uploading the compressed (zip) project folder, and attaching an URL here, so i can try to reproduce and debug it locally?
    Thanks,
    Tesa :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants