Closed lschneiderman closed 3 years ago
brightcovePlayerLoader({
refNode: document.querySelector("#mainvid"),
accountId: myAccountNum,
playerId: "947WeZ6d",
videoId: myVidID,
})
.then(function (success) {
myPlayer = success.ref
myPlayer.on("loadedmetadata", function () {
$(".vid-thumbnail").on("click", function () {
var vidChunk = $(this).parent()
var thisID = vidChunk.attr("id")
thisID = thisID.replace("vidchunk", "") //gives me a videoID
$(this).videoId = thisID //error is: Uncaught TypeError: $(...).videoId is not a function
})
})
})
.catch(function (error) {
console.log("error", error)
})
You can use the catalog API on the player to load the new video ID
brightcovePlayerLoader({
refNode: document.querySelector("#mainvid"),
accountId: myAccountNum,
playerId: "947WeZ6d",
videoId: myVidID,
})
.then(function (success) {
myPlayer = success.ref
myPlayer.on("loadedmetadata", function () {
$(".vid-thumbnail").on("click", function () {
var vidChunk = $(this).parent()
var thisID = vidChunk.attr("id")
thisID = thisID.replace("vidchunk", "") //gives me a videoID
// load a new video ID
myPlayer.catalog.getVideo(thisID, funciton(err, video) {
if (err) {
console.log('couldn't get video');
return;
}
myPlayer.catalog.load(video);
});
})
})
})
.catch(function (error) {
console.log("error", error)
})
How would I keep the player but load a new video into it?
brightcovePlayerLoader({ refNode: document.querySelector('#mainvid'), accountId: myAccountNum, playerId: '947WeZ6d', videoId: myVidID }) .then(function(success) { myPlayer = success.ref; myPlayer.on('loadedmetadata',function(){ $('.vid-thumbnail').on('click', function() { var vidChunk = $(this).parent(); var thisID = vidChunk.attr("id"); thisID = thisID.replace("vidchunk",""); //gives me a videoID $(this).videoId = thisID; //error is: Uncaught TypeError: $(...).videoId is not a function }); ); }) .catch(function(error) { console.log('error', error); });