Skip to content

Commit

Permalink
feat(ovp-provider): implement ovp provider (#1)
Browse files Browse the repository at this point in the history
* Ovp provider implementation
  • Loading branch information
tanyaLibatter authored May 7, 2017
1 parent 705131d commit f9744c6
Show file tree
Hide file tree
Showing 44 changed files with 4,811 additions and 3 deletions.
14 changes: 14 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"exclude": [
"test/"
],
"reporter": [
"text",
"html"
],
"require": [
"babel-register"
],
"sourceMap": false,
"instrument": false
}
9 changes: 9 additions & 0 deletions flow-typed/interfaces/loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//@flow
import RequestBuilder from '../../src/k-provider/request-builder'

declare interface ILoader {
static name: string;
requests: Array<RequestBuilder>;
response: any;
isValid(): boolean;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@
"url": "https://github.com/kaltura/playkit-js-providers/issues"
},
"homepage": "https://github.com/kaltura/playkit-js-providers#readme"
}
}
31 changes: 31 additions & 0 deletions src/entities/drm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//@flow

import {Scheme} from '../k-provider/enums';

/**
* Drm data
* @classdesc
*/
export default class Drm {

/**
* @member - license URL
* @type {string}
*/
licenseUrl: string;
/**
* @member - drm scheme
* @type {Scheme}
*/
scheme: Scheme;

/**
* @constructor
* @param {string} licenseUrl - the license URL
* @param {Scheme} scheme - the drm scheme
*/
constructor(licenseUrl: string, scheme: Scheme) {
this.licenseUrl = licenseUrl;
this.scheme = scheme;
}
}
46 changes: 46 additions & 0 deletions src/entities/media-entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//@flow
import MediaSource from './media-source'
import {MediaEntryType} from '../k-provider/enums'

/**
* Media entry
* @classdesc
*/
export default class MediaEntry {

/**
* @member - entry ID
* @type {string}
*/
id: string;
/**
* @member - entry sources
* @type {Array<MediaSource>}
*/
sources: Array<MediaSource>;
/**
* @member - entry duration
* @type {number}
*/
duration: number;
/**
* @member - entry type
* @type {MediaEntryType}
*/
type: MediaEntryType;
/**
* @member - entry metadata
* @type {Map<string,string>}
*/
metaData: Map<string,string>;

/**
* @constructor
*/
constructor() {
this.metaData = new Map();
this.type = MediaEntryType.Unknown;
}


}
50 changes: 50 additions & 0 deletions src/entities/media-format.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//@flow
import {Enum} from 'enumify';

export class MediaFormat extends Enum {
}
MediaFormat.initEnum({
dash: {
get mimeType() {
return "application/dash+xml";
},
get pathExt() {
return "mpd";
}
},
hls: {
get mimeType() {
return "application/x-mpegURL";
},
get pathExt() {
return "m3u8";
}
},
wvm: {
get mimeType() {
return "video/wvm";
},
get pathExt() {
return "wvm";
}
},
mp4: {
get mimeType() {
return "video/mp4";
},
get pathExt() {
return "mp4";
}
},
mp3: {
get mimeType() {
return "audio/mpeg";
},
get pathExt() {
return "mp3";
}
}
});



35 changes: 35 additions & 0 deletions src/entities/media-source.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//@flow
import Drm from '../entities/drm'

/**
* Media source
* @classdesc
*/
export default class MediaSource {
/**
* @member - media source ID
* @type {string}
*/
id: string;
/**
* @member - media source URL
* @type {string}
*/
src: string;
/**
* @member - media source mimetype
* @type {string}
*/
mimetype: string;
/**
* @member - media source drm data
* @type {Array<Drm>}
*/
drmData: Array<Drm>;

/**
* @constructor
*/
constructor(){}
}

14 changes: 14 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<title>Title</title>
<script src="ovpProvider.js" type="text/javascript"></script>



</head>
<body>
</body>
</html>
65 changes: 65 additions & 0 deletions src/k-provider/base-service-result.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//@flow

/**
* Base service result
* @classdesc
*/
export default class ServiceResult {

/**
* @member - Is service returned an error
* @type {boolean}
*/
hasError: boolean = false;
/**
* @member - The service error
* @type {ServiceError}
*/
error: ServiceError;
/**
* @member - The service result data
* @type {Object}
*/
data: Object;

/**
* @constructor
* @param {Object} response - Service response
*/
constructor(response: Object) {
if (response.objectType === "KalturaAPIException") {
this.hasError = true;
this.error = new ServiceError(response.code, response.message);
}
else {
this.data = response;
}
}
}

/**
* Service error
* @classdesc
*/
class ServiceError {
/**
* @member - The error code
* @type {string}
*/
code: string;
/**
* @member - The error message
* @type {string}
*/
message: string;

/**
* @constructor
* @param {string} code - The result code
* @param {string} message - The result message
*/
constructor(code: string, message: string) {
this.code = code;
this.message = message;
}
}
Loading

0 comments on commit f9744c6

Please sign in to comment.