Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

karma test cases


Im trying to write a karma test case for the following code which im using it in my controller im my project.
playerInstance = jwplayer("myElement")
playerInstance.setup({
primary: playerPrimary,
file: videoURL,
image: videoImage,
title:title,
description:description,
tracks: [{
file:restEndPoint+caption,
label: "English",
kind: "captions",
"default": true
}],
width: '100%',
aspectratio:"16:9",
preload:"none"
});

but it fails :TypeError: 'undefined' is not a function (evaluating 'playerInstance.setup')
when i did console.log(playerInstance), it has only one function registerPlugin().it does not have other api's.
Can someone post examples of karma test cases and can you provide me solution for that.

1 Community Answers

George

JW Player Support Agent  
0 rated :

Hi,

We don’t officially support your test library, but from the error you are getting my best guess would be the JW Player javascript library is not fully loaded when the functions are called.

This question has received the maximum number of answers.