-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ovp-provider): implement ovp provider (#1)
* Ovp provider implementation
- Loading branch information
1 parent
705131d
commit f9744c6
Showing
44 changed files
with
4,811 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
} | ||
} | ||
}); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(){} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.