Skip to content

Instantly share code, notes, and snippets.

@efogdev
Created January 20, 2017 14:06
Show Gist options
  • Save efogdev/c87c682ef4b93f03d6a01ba91cbfbac0 to your computer and use it in GitHub Desktop.
Save efogdev/c87c682ef4b93f03d6a01ba91cbfbac0 to your computer and use it in GitHub Desktop.
function ($scope, element) {
var options = $scope.options || {};
$scope.playing = false;
var thumbnailUrl = $scope.thumbnailUrl = options.img || '',
videoUrl = options.videoUrl || '',
title = $scope.title = options.mediaTitle || 'Unknown Title',
description = options.description || '',
id = options.id || -1,
rating = $scope.rating = options.rating || 0;
$scope.showPlayer = function () {
$rdPlayer.clear();
var playerElement = $('<div></div>')
.addClass('rd-player')
.attr('id', 'player' + id);
element.find('.jw-player-instance').append(playerElement);
$scope.player = jwplayer(playerElement[0]);
$scope.player.setup({
file: videoUrl,
image: thumbnailUrl,
width: '100%',
height: '100%',
title: title,
description: description,
mediaid: id
});
$scope.playing = true;
};
$scope.play = function () {
$scope.player.play();
};
$scope.fullscreen = function () {
$scope.player.setFullscreen(true);
};
}])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment