You may have cases where you need to change the video associated with a player. For example, maybe the viewer has the ability to control which video they want to see. Maybe the video in the player is based upon which part of the site the viewer came from.
If you need to display different videos in a player, it is recommended to use one player and then dynamically change the video associated with the player.
The following techniques are outlined in this topic:
Content can also be dynamically assigned to a player using the Catalog API. For more information and sample code, see the developer document Dynamically Change Source Videos.
You can change the video source for a player by passing the video ID as a URL parameter using the form ?videoId=YOUR_VIDEO_ID
.
http://players.brightcove.net/20318290001/f1d70e07-8480-4bbd-b4ef-747e9333a034_default/index.html?videoId=4292158104001
You can change the video source for a player by passing the reference ID as a URL parameter using the form ?videoId=ref:YOUR_VIDEO_REF_ID
.
http://players.brightcove.net/20318290001/f1d70e07-8480-4bbd-b4ef-747e9333a034_default/index.html?videoId=ref:1234
You can assign a {{ site.product_short }} video to the player embed code directly using the video ID.
Add the attribute data-video-id="YOUR_VIDEO_ID"
to the <video>
tag:
<video-js data-account="57838016001"
data-player="6e44f16e-31e9-48b2-83b9-6edd71217540"
data-embed="default"
data-video-id="68143720001"
class="video-js"
controls></video-js>
<script src="https://players.brightcove.net/57838016001/6e44f16e-31e9-48b2-83b9-6edd71217540_default/index.min.js"></script>
Add ?videoId=YOUR_VIDEO_ID
to the end of the URL in the src
attribute for the iframe:
<iframe src='//players.brightcove.net/57838016001/6e44f16e-31e9-48b2-83b9-6edd71217540_default/index.html?videoId=68143720001'
allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe>
You can assign a {{ site.product_short }} video to the player embed code directly using the reference ID.
Add the attribute data-video-id="ref:YOUR_VIDEO_REF_ID"
to the <video>
tag:
<video-js data-account="57838016001"
data-player="6e44f16e-31e9-48b2-83b9-6edd71217540"
data-embed="default"
data-video-id="ref:68143720001"
class="video-js"
controls></video-js>
<script src="https://players.brightcove.net/57838016001/6e44f16e-31e9-48b2-83b9-6edd71217540_default/index.min.js"></script>
Add ?videoId=ref:YOUR_VIDEO_REF_ID
to the end of the URL in the src
attribute for the iframe:
<iframe src='//players.brightcove.net/57838016001/6e44f16e-31e9-48b2-83b9-6edd71217540_default/index.html?videoId=ref:68143720001'
allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe>