Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
lib
src/lib/bundle.js
src/lib/bundle.min.js
!src/lib
src/lib/*
!src/extensions/**/lib

#################
Expand Down
456 changes: 228 additions & 228 deletions package-lock.json

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 @@ -40,7 +40,7 @@
"chalk": "0.5.1",
"glob": "7.1.3",
"glob-array": "1.0.0",
"grunt": "1.0.3",
"grunt": "^1.0.3",
"grunt-cli": "1.3.1",
"grunt-contrib-clean": "0.4.0",
"grunt-contrib-compress": "1.4.3",
Expand Down Expand Up @@ -80,7 +80,7 @@
"@types/requirejs": "2.1.28",
"@types/three": "0.84.20",
"@universalviewer/uv-cy-gb-theme": "1.1.2",
"@universalviewer/uv-ebook-components": "^1.0.0",
"@universalviewer/uv-ebook-components": "^1.0.1",
"@universalviewer/uv-en-gb-theme": "1.1.2",
"core-js": "2.4.1",
"dashjs": "2.6.7",
Expand Down
101 changes: 54 additions & 47 deletions src/extensions/uv-av-extension/dependencies.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,54 @@
define(function () {
function isFormatAvailable(formats, format) {
var isAvailable = formats.includes(format);
return isAvailable;
}
function isHLSFormatAvailable(formats) {
return isFormatAvailable(formats, 'application/vnd.apple.mpegurl') || isFormatAvailable(formats, 'vnd.apple.mpegurl');
}
function isMpegDashFormatAvailable(formats) {
return isFormatAvailable(formats, 'application/dash+xml');
}
function canPlayHls() {
var doc = typeof document === 'object' && document, videoelem = doc && doc.createElement('video'), isvideosupport = Boolean(videoelem && videoelem.canPlayType), canPlay = [
'application/vnd.apple.mpegurl',
'audio/mpegurl',
'audio/x-mpegurl',
'application/x-mpegurl',
'video/x-mpegurl',
'video/mpegurl',
'application/mpegurl'
];
return isvideosupport && canPlay.some(function (canItPlay) {
return /maybe|probably/i.test(videoelem.canPlayType(canItPlay));
});
}
return function (formats) {
var alwaysRequired = ['TreeComponent', 'AVComponent', 'MetadataComponent', 'jquery-ui.min', 'jquery.ui.touch-punch.min', 'jquery.binarytransport', 'waveform-data'];
if (isHLSFormatAvailable(formats) && canPlayHls()) {
console.log('load HLS');
return {
sync: alwaysRequired.concat(['hls.min'])
};
}
else if (isMpegDashFormatAvailable(formats)) {
console.log('load mpeg dash');
return {
sync: alwaysRequired.concat(['dash.all.min'])
};
}
else {
console.log('adaptive streaming not available');
return {
sync: alwaysRequired
};
}
};
});
define(function () {
function isFormatAvailable(formats, format) {
var isAvailable = formats.includes(format);
return isAvailable;
}
function isHLSFormatAvailable(formats) {
return isFormatAvailable(formats, 'application/vnd.apple.mpegurl') || isFormatAvailable(formats, 'vnd.apple.mpegurl');
}
function isMpegDashFormatAvailable(formats) {
return isFormatAvailable(formats, 'application/dash+xml');
}
function canPlayHls() {
var doc = typeof document === 'object' && document, videoelem = doc && doc.createElement('video'), isvideosupport = Boolean(videoelem && videoelem.canPlayType),
// HLS manifests can go by many mime-types
canPlay = [
// Apple santioned
'application/vnd.apple.mpegurl',
// Apple sanctioned for backwards compatibility
'audio/mpegurl',
// Very common
'audio/x-mpegurl',
// Very common
'application/x-mpegurl',
// Included for completeness
'video/x-mpegurl',
'video/mpegurl',
'application/mpegurl'
];
return isvideosupport && canPlay.some(function (canItPlay) {
return /maybe|probably/i.test(videoelem.canPlayType(canItPlay));
});
}
return function (formats) {
var alwaysRequired = ['TreeComponent', 'AVComponent', 'MetadataComponent', 'jquery-ui.min', 'jquery.ui.touch-punch.min', 'jquery.binarytransport', 'waveform-data'];
if (isHLSFormatAvailable(formats) && canPlayHls()) {
console.log('load HLS');
return {
sync: alwaysRequired.concat(['hls.min'])
};
}
else if (isMpegDashFormatAvailable(formats)) {
console.log('load mpeg dash');
return {
sync: alwaysRequired.concat(['dash.all.min'])
};
}
else {
console.log('adaptive streaming not available');
return {
sync: alwaysRequired
};
}
};
});
12 changes: 1 addition & 11 deletions src/extensions/uv-av-extension/dependencies.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
define(function() {

// https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Live_streaming_web_audio_and_video
// Dash is supported everywhere except safari
// function isSafari() {
// // https://stackoverflow.com/questions/7944460/detect-safari-browser?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
// var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
// console.log('isSafari', isSafari);
// return isSafari;
// }

function isFormatAvailable(formats: string[], format: string) {
var isAvailable = formats.includes(format);
//console.log('isFormatAvailable', format, isAvailable);
return isAvailable;
}

Expand Down Expand Up @@ -70,4 +60,4 @@ define(function() {
}

}
});
});
14 changes: 7 additions & 7 deletions src/extensions/uv-default-extension/dependencies.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
define(function () {
return function (formats) {
return {
async: ['MetadataComponent']
};
};
});
define(function () {
return function (formats) {
return {
async: ['MetadataComponent']
};
};
});
4 changes: 3 additions & 1 deletion src/extensions/uv-ebook-extension/Events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ export class Events {
static RELOCATED: string = Events.namespace + "relocated";
static RENDITION_ATTACHED: string = Events.namespace + "renditionAttached";
static TOC_READY: string = Events.namespace + "tocReady";
}
static PRINT: string = Events.namespace + "print";
static EBOOK_READY: string = Events.namespace + "ebookReady";
}
Loading