Skip to content
This repository was archived by the owner on Oct 20, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 7 additions & 37 deletions dist/mi-angular-bitdash-player.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mi-angular-bitdash-player.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"homepage": "https://github.com/MovingImage24/mi-angular-bitdash-player#readme",
"dependencies": {},
"devDependencies": {
"angular": "^1.4.9",
"angular-mocks": "^1.4.9",
"angular": "~1.5.8",
"angular-mocks": "1.5.1",
"istanbul-instrumenter-loader": "^0.2.0",
"jasmine-core": "^2.3.4",
"jscs": "^3.0.0",
Expand Down
43 changes: 7 additions & 36 deletions src/bitdash-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,48 +20,19 @@ module.exports = function ($window) {
link: function (scope) {
var config = scope.config; // die config wird automatisch durch den controller erweitert
var player = $window.window.bitmovin.player('mi-bitdash-player');
// tech support - flash and hls
var supportedTech = player.getSupportedTech();
// force HLS / Flash playback if available
var hlsTech = [];
var flashForce = false;
var cuepointsSupported = false;

angular.forEach(supportedTech, function (tech) {
if (tech.streaming === 'hls') {
hlsTech.push(tech.player + '.' + tech.streaming);
}
});

if (hlsTech.indexOf('flash.hls') !== -1) {
flashForce = true;
cuepointsSupported = true;
}

if (hlsTech.indexOf('native.hls') !== -1) {
flashForce = false;
cuepointsSupported = true;
// ToDo check for Android, Android does not support CuePoints via HTML5
}

if (player.isReady() && !flashForce) {
// funktioniert derzeit nur für den NON-Flash ... flashie selbst fällt sehr laut hin ... Dreck
player.destroy();
player = $window.window.bitmovin.player('mi-bitdash-player');
}

player.setup(config);

var state = scope.webcast.state + 'StateData';
var bitmovinControlbar = angular.element(document.getElementsByClassName('bitdash-vc'));

if (angular.isDefined(scope.webcast[state].playout.audioOnly) && scope.webcast[state].playout.audioOnly) {
var bitmovinControlbar = angular.element(document.getElementsByClassName('bitdash-vc'));
bitmovinControlbar[0].style.minHeight = '30px';
bitmovinControlbar[0].style.minWidth = '195px';
} else {
if (angular.isDefined(bitmovinControlbar[0])) {
bitmovinControlbar[0].style.minWidth = '360px';
}
}
}
};
};




};
11 changes: 1 addition & 10 deletions test/bitdash-directive.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('BitdashDirective', function () {

beforeEach(function () {
var window = jasmine.createSpy('window');
player = jasmine.createSpyObj('player', ['getSupportedTech', 'isReady', 'destroy', 'setup']);
player = jasmine.createSpyObj('player', ['isReady', 'setup']);
player.isReady.and.returnValue(true);
window.bitmovin = {
player: function () { return player;}
Expand All @@ -37,7 +37,6 @@ describe('BitdashDirective', function () {
}));

it('Should set up the player in flash mode', angular.mock.inject(function ($compile, $rootScope) {
player.getSupportedTech.and.returnValue([{streaming: 'hls', player: 'flash'}]);
$rootScope.webcastMainVm = {playerConfig: {foo: 'bar'}, webcast: {
state: 'postlive',
postliveStateData: {
Expand All @@ -49,13 +48,10 @@ describe('BitdashDirective', function () {

$compile(template)($rootScope);
$rootScope.$apply();
expect(player.getSupportedTech).toHaveBeenCalled();
expect(player.destroy).not.toHaveBeenCalled();
expect(player.setup).toHaveBeenCalledWith({foo: 'bar'});
}));

it('Should set up the player in native mode', angular.mock.inject(function ($compile, $rootScope) {
player.getSupportedTech.and.returnValue([{streaming: 'hls', player: 'native'}]);
$rootScope.webcastMainVm = {playerConfig: {foo: 'bar'}, webcast: {
state: 'postlive',
postliveStateData: {
Expand All @@ -67,13 +63,10 @@ describe('BitdashDirective', function () {

$compile(template)($rootScope);
$rootScope.$apply();
expect(player.getSupportedTech).toHaveBeenCalled();
expect(player.setup).toHaveBeenCalledWith({foo: 'bar'});
expect(player.destroy).toHaveBeenCalledTimes(1);
}));

it('Should set up the player for audio only in flash mode', angular.mock.inject(function ($compile, $rootScope) {
player.getSupportedTech.and.returnValue([{streaming: 'hls', player: 'flash'}]);
$rootScope.webcastMainVm = {playerConfig: {foo: 'bar'}, webcast: {
state: 'postlive',
postliveStateData: {
Expand All @@ -85,8 +78,6 @@ describe('BitdashDirective', function () {

$compile(template)($rootScope);
$rootScope.$apply();
expect(player.getSupportedTech).toHaveBeenCalled();
expect(player.destroy).not.toHaveBeenCalled();
expect(player.setup).toHaveBeenCalledWith({foo: 'bar'});
}));

Expand Down