How to pass variable from page to Brightcove HTML player while using Video tag for the video?
This is the page:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<style media="screen">
body
background-color: #111;
color: #fff;
</style>
</head>
<body>
<script src="https://www.netapp.com/us/static/js/jquery-1.8.1.min.js"></script>
<video-js id="myPlayerID"
data-video-id="5448507890001"
data-account="260701648001"
data-player="FcmqUildl"
data-embed="default"
data-application-id
class="video-js"
controls
width="640"
height="360"></video-js>
<script src="https://players.brightcove.net/260701648001/FcmqUildl_default/index.min.js"></script>
<script type="text/javascript">
$( window ).load(function()
videojs.getPlayer('myPlayerID').ready(function()
var cid = "12345";
var myPlayer = this;
iframeTag = document.querySelector("iframe").contentWindow;
iframeTag.postMessage(cid, "*");
);
);
</script>
</body>
</html>
I want to pass variable from this page to the Brightcove Video that is added using video tag.
I have added below code as plugin in Brightcove.
videojs.registerPlugin('listenForParent', function()
var myPlayer = this;
// This method called when postMessage sends data into the iframe
function controlVideo(evt)
console.log("evt.data" + evt.data)
;
// Listen for the message, then call controlVideo() method when received
window.addEventListener("message",controlVideo);
);
This gives the error Cannot read property 'contentWindow' of null. I was referring this example https://support.brightcove.com/brightcove-player-sample-playpause-video-iframe-parent which explains how to pass the variable from page to iframe.
How can we pass the variable when we have the video added with the help of Video tag.Any idea?
brightcove
add a comment |
This is the page:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<style media="screen">
body
background-color: #111;
color: #fff;
</style>
</head>
<body>
<script src="https://www.netapp.com/us/static/js/jquery-1.8.1.min.js"></script>
<video-js id="myPlayerID"
data-video-id="5448507890001"
data-account="260701648001"
data-player="FcmqUildl"
data-embed="default"
data-application-id
class="video-js"
controls
width="640"
height="360"></video-js>
<script src="https://players.brightcove.net/260701648001/FcmqUildl_default/index.min.js"></script>
<script type="text/javascript">
$( window ).load(function()
videojs.getPlayer('myPlayerID').ready(function()
var cid = "12345";
var myPlayer = this;
iframeTag = document.querySelector("iframe").contentWindow;
iframeTag.postMessage(cid, "*");
);
);
</script>
</body>
</html>
I want to pass variable from this page to the Brightcove Video that is added using video tag.
I have added below code as plugin in Brightcove.
videojs.registerPlugin('listenForParent', function()
var myPlayer = this;
// This method called when postMessage sends data into the iframe
function controlVideo(evt)
console.log("evt.data" + evt.data)
;
// Listen for the message, then call controlVideo() method when received
window.addEventListener("message",controlVideo);
);
This gives the error Cannot read property 'contentWindow' of null. I was referring this example https://support.brightcove.com/brightcove-player-sample-playpause-video-iframe-parent which explains how to pass the variable from page to iframe.
How can we pass the variable when we have the video added with the help of Video tag.Any idea?
brightcove
add a comment |
This is the page:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<style media="screen">
body
background-color: #111;
color: #fff;
</style>
</head>
<body>
<script src="https://www.netapp.com/us/static/js/jquery-1.8.1.min.js"></script>
<video-js id="myPlayerID"
data-video-id="5448507890001"
data-account="260701648001"
data-player="FcmqUildl"
data-embed="default"
data-application-id
class="video-js"
controls
width="640"
height="360"></video-js>
<script src="https://players.brightcove.net/260701648001/FcmqUildl_default/index.min.js"></script>
<script type="text/javascript">
$( window ).load(function()
videojs.getPlayer('myPlayerID').ready(function()
var cid = "12345";
var myPlayer = this;
iframeTag = document.querySelector("iframe").contentWindow;
iframeTag.postMessage(cid, "*");
);
);
</script>
</body>
</html>
I want to pass variable from this page to the Brightcove Video that is added using video tag.
I have added below code as plugin in Brightcove.
videojs.registerPlugin('listenForParent', function()
var myPlayer = this;
// This method called when postMessage sends data into the iframe
function controlVideo(evt)
console.log("evt.data" + evt.data)
;
// Listen for the message, then call controlVideo() method when received
window.addEventListener("message",controlVideo);
);
This gives the error Cannot read property 'contentWindow' of null. I was referring this example https://support.brightcove.com/brightcove-player-sample-playpause-video-iframe-parent which explains how to pass the variable from page to iframe.
How can we pass the variable when we have the video added with the help of Video tag.Any idea?
brightcove
This is the page:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<style media="screen">
body
background-color: #111;
color: #fff;
</style>
</head>
<body>
<script src="https://www.netapp.com/us/static/js/jquery-1.8.1.min.js"></script>
<video-js id="myPlayerID"
data-video-id="5448507890001"
data-account="260701648001"
data-player="FcmqUildl"
data-embed="default"
data-application-id
class="video-js"
controls
width="640"
height="360"></video-js>
<script src="https://players.brightcove.net/260701648001/FcmqUildl_default/index.min.js"></script>
<script type="text/javascript">
$( window ).load(function()
videojs.getPlayer('myPlayerID').ready(function()
var cid = "12345";
var myPlayer = this;
iframeTag = document.querySelector("iframe").contentWindow;
iframeTag.postMessage(cid, "*");
);
);
</script>
</body>
</html>
I want to pass variable from this page to the Brightcove Video that is added using video tag.
I have added below code as plugin in Brightcove.
videojs.registerPlugin('listenForParent', function()
var myPlayer = this;
// This method called when postMessage sends data into the iframe
function controlVideo(evt)
console.log("evt.data" + evt.data)
;
// Listen for the message, then call controlVideo() method when received
window.addEventListener("message",controlVideo);
);
This gives the error Cannot read property 'contentWindow' of null. I was referring this example https://support.brightcove.com/brightcove-player-sample-playpause-video-iframe-parent which explains how to pass the variable from page to iframe.
How can we pass the variable when we have the video added with the help of Video tag.Any idea?
brightcove
brightcove
edited Nov 13 '18 at 15:03
vids
asked Nov 13 '18 at 4:22
vidsvids
3710
3710
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53273766%2fhow-to-pass-variable-from-page-to-brightcove-html-player-while-using-video-tag-f%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53273766%2fhow-to-pass-variable-from-page-to-brightcove-html-player-while-using-video-tag-f%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown