Reputation: 151
I am using JWPlayer 7 to initialize a video player manually like this:
jwplayer(videoContainer).setup({
file: '//content.jwplatform.com/videos/'+ assetID +'.mp4',
image: '//content.jwplatform.com/thumbs/' + assetID + '.jpg',
title: title,
category: "video",
width: "100%",
primary: 'html5',
autostart: autoplay,
ga: {
label: "title"
}
});
Where "title" is passed in as a custom title I generate. In the ga block in my setup, I have to pass a custom title so that in Google Analytics, when I view custom events, the title will show up as "John Doe - John Doe Talks About Stuff" instead of what it shows by default, which is a cryptic looking URL to the video.
However, I discovered that when I setup my video player this way, even though we have transcoded our videos with various qualities, if I pass the video URL through the "file" option like I did above, it will only deliver the lower quality video and it won't give the user the option of selecting different qualities in the video player (1080p, 720p, etc.).
When I initialized my player like this:
<script type="text/javascript" src="http://content.jwplatform.com/players/<video id>-<player id>.js"></script>
JWPlayer would take care of all that for me and the user could select a different quality video. The flip side of calling the player like this is that I can't set the Google Analytics the way I want.
So there are actually three questions I have here:
Upvotes: 1
Views: 782
Reputation: 1103
You should use sources when setting multiple video files (Multiple bitrates)
<script>
var playerInstance = jwplayer("myElement");
playerInstance.setup({
image: "/uploads/myPoster.jpg",
sources: [{
file: "/uploads/myVideo-360.mp4"
},{
file: "/uploads/myVideo-720.mp4"
}]
});
</script>
You can also use JWPlayer events and call the analytics ga method on your own
jwplayer().onPlay(function() {ga('send', 'event', 'JW Video Play', 'Video Title')});
Upvotes: 0