Commit 0fc70047 by Masaru Abe

動画キャッシュ対応

parent 5b5e4c85
......@@ -845,9 +845,11 @@ function avwSetLogoutNortice() {
window.onbeforeunload = function(event) {
//DHカスタム
if( ClientData.serviceOpt_daihatsu() == 'Y'){
if(contentID != null ){
SetEndLog(contentID);
RegisterLog();
if( "contentID" in window ){
if(contentID != null ){
SetEndLog(contentID);
RegisterLog();
}
}
} else {
// メッセージ表示
......@@ -867,9 +869,9 @@ function avwScreenMove(url) {
window.location = url;
};
/* Debug Log */
function avwLog(msg) {
AVWEB.avwLog = function(msg) {
if(avwSysSetting().debug) {
console.log(msg);
console.log(msg);
}
};
......
......@@ -38,24 +38,6 @@
<link rel="stylesheet" type="text/css" href="css/layout/limit_access.css?#UPDATEID#" />
<link rel="stylesheet" type="text/css" href="css/theme/limit_access.css?#UPDATEID#" />
<script type="text/javascript" src="./common/js/jquery-1.8.1.min.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/jquery-ui-1.8.23.custom.min.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/jquery.toastmessage.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/avweb.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/i18n.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/common.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/uuid.js?#UPDATEID#"></script>
<script type="text/javascript" src="./js/contentview_FileSystem.js?__UPDATEID__"></script>
<script type="text/javascript" src="./js/Limit_Access_Content.js?#UPDATEID#"></script>
<script type="text/javascript" src="./js/home.js?#UPDATEID#"></script>
<script type="text/javascript" src="./js/header.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/scrolltopcontrol.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/tab.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/jquery.cookie.js?#UPDATEID#" ></script>
<script type="text/javascript" src="./common/js/jquery.treeview.edit.js?#UPDATEID#" ></script>
<script type="text/javascript" src="./common/js/jquery.treeview.js?#UPDATEID#" ></script>
<script type="text/javascript" src="./common/js/screenLock.js?#UPDATEID#" ></script>
<script type="text/javascript" src="./js/detail.js?#UPDATEID#" ></script>
</head>
......@@ -239,5 +221,24 @@
<iframe style="height:0px;width:0px;visibility:hidden;display:none;" src="about:blank">
this frame prevents back forward cache
</iframe>
<script type="text/javascript" src="./common/js/jquery-1.8.1.min.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/jquery-ui-1.8.23.custom.min.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/jquery.toastmessage.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/avweb.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/i18n.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/common.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/uuid.js?#UPDATEID#"></script>
<script type="text/javascript" src="./js/Limit_Access_Content.js?#UPDATEID#"></script>
<script type="text/javascript" src="./js/home.js?#UPDATEID#"></script>
<script type="text/javascript" src="./js/header.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/scrolltopcontrol.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/tab.js?#UPDATEID#"></script>
<script type="text/javascript" src="./common/js/jquery.cookie.js?#UPDATEID#" ></script>
<script type="text/javascript" src="./common/js/jquery.treeview.edit.js?#UPDATEID#" ></script>
<script type="text/javascript" src="./common/js/jquery.treeview.js?#UPDATEID#" ></script>
<script type="text/javascript" src="./common/js/screenLock.js?#UPDATEID#" ></script>
<script type="text/javascript" src="./js/detail.js?#UPDATEID#" ></script>
</body>
</html>
\ No newline at end of file
......@@ -2318,10 +2318,12 @@ function displayOverlayForHtmlAndMediaType(){
//END TRB00075 - Editor: Long - Date - 24/09/2013 - Summary : Fix for prevent moving page when display dialog
//Display overlay dialog for specify content type
function displayOverlayForSpecifyContentType(){
function displayOverlayForSpecifyContentType( resourceUrl ){
var contentId = ClientData.contentInfo_contentId();
var resourceUrl = downloadResourceById(contentId);
if( resourceUrl == null ){
resourceUrl = downloadResourceById(contentId);
}
//contentType = ContentTypeKeys.Type_Html;
if(contentType == ContentTypeKeys.Type_Music){
......@@ -2767,6 +2769,31 @@ function downloadResourceById(contentId){
return resourceUrl;
};
CONTENTVIEW.getVideoContentResourceId = function(contentId){
if(contentType != ContentTypeKeys.Type_Video){
return null;
}
var params = {
sid: ClientData.userInfo_sid(),
contentId: contentId,
getType: '2',
};
var resourceId;
abapi('webGetContent', params, 'GET', function (data) {
$.each(data.contentData , function(i, n){
if(typeof n == "object"){
resourceId = n.resourceId;
}
});
//Get resource
});
return resourceId;
};
//Start : TRB00015 - Editor : Long - Date : 08/28/2013 - Summary : For win 8 rotate handling.
function setViewportForWin8(){
if (window.navigator.msPointerEnabled) {
......@@ -2852,7 +2879,7 @@ CONTENTVIEW.ready = function(){
CONTENTVIEW.webGetContentApi_funcOk = function(data){
console.log("CONTENTVIEW.webGetContentApi_funcOk:" + data.contentData.contentType);
//console.log("CONTENTVIEW.webGetContentApi_funcOk:" + data.contentData.contentType);
contentType = data.contentData.contentType;
......@@ -2890,9 +2917,7 @@ CONTENTVIEW.webGetContentApi_funcOk = function(data){
//END TRB00059 - EDITOR: Long - Date : 09/19/2013 - Summary : Add title for media and html type
}
else{
console.log("CONTENTVIEW.webGetContentApi_funcOk:initPage");
//console.log("CONTENTVIEW.webGetContentApi_funcOk:initPage");
initPage();
}
}
......
......@@ -15,7 +15,7 @@ CONTENTVIEW_FILESYSTEM.initFS = function( func ) {
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
// Initiate filesystem on page load.
if (!window.requestFileSystem) {
console.log("window.requestFileSystem is null");
//console.log("window.requestFileSystem is null");
if( func != null ){
func();
}
......@@ -26,7 +26,7 @@ CONTENTVIEW_FILESYSTEM.initFS = function( func ) {
window.TEMPORARY,
1024*1024,
function(filesystem) {
console.log("initFS window.requestFileSystem");
//console.log("initFS window.requestFileSystem");
CONTENTVIEW_FILESYSTEM.fs = filesystem;
CONTENTVIEW_FILESYSTEM.fs.root.getDirectory(
'abook',
......@@ -53,7 +53,7 @@ CONTENTVIEW_FILESYSTEM.initFS = function( func ) {
CONTENTVIEW_FILESYSTEM.savePageFile = function(contentId, fileName, data) {
if (!CONTENTVIEW_FILESYSTEM.fs) {
console.log('CONTENTVIEW_FILESYSTEM.fs is null. id=' + contentId);
//console.log('CONTENTVIEW_FILESYSTEM.fs is null. id=' + contentId);
return;
}
......@@ -93,7 +93,7 @@ CONTENTVIEW_FILESYSTEM.savePageFile = function(contentId, fileName, data) {
CONTENTVIEW_FILESYSTEM.deleteContentDir = function(contentId) {
if (!CONTENTVIEW_FILESYSTEM.fs) {
console.log('CONTENTVIEW_FILESYSTEM.fs is null. id=' + contentId);
//console.log('CONTENTVIEW_FILESYSTEM.fs is null. id=' + contentId);
return;
}
......@@ -116,7 +116,7 @@ CONTENTVIEW_FILESYSTEM.deleteContentDir = function(contentId) {
CONTENTVIEW_FILESYSTEM.checkUpdate = function(contentId, data, func) {
if (!CONTENTVIEW_FILESYSTEM.fs) {
console.log('CONTENTVIEW_FILESYSTEM.fs is null. id=' + contentId);
//console.log('CONTENTVIEW_FILESYSTEM.fs is null. id=' + contentId);
//おまじない ajaxカウントをインクリする必要有り
//nAjaxLoad++;
//ファンクションがあれば実行
......@@ -269,7 +269,7 @@ CONTENTVIEW_FILESYSTEM.showVideoObjectCache = function(x, y, width, height, src,
console.log('CONTENTVIEW_FILESYSTEM.showVideoObjectCache');
if (!CONTENTVIEW_FILESYSTEM.fs) {
console.log('CONTENTVIEW_FILESYSTEM.fs is null. id=' + contentId);
//console.log('CONTENTVIEW_FILESYSTEM.fs is null. id=' + contentId);
showVideoObject(x, y, width, height, src, isFullscreen, true);
return;
}
......
......@@ -126,7 +126,7 @@ function initPage() {
//abe
//alert("initPage");
console.log("initPage");
//console.log("initPage");
//START : TRB00034 - DATE : 09/11/2013 - Editor : Long - Summary : Fix for center loading image
setLoadingSize();
......@@ -278,7 +278,7 @@ function initPage() {
/*Init Page */
nAjaxLoad++;
console.log("nAjaxLoad:" + nAjaxLoad);
//console.log("nAjaxLoad:" + nAjaxLoad);
if (nAjaxLoad == 8) {
/* handle from bookmark page */
......@@ -603,21 +603,110 @@ function initPageMediaAndHtmlType(){
//enable SpecifyControl
enableSpecifyControl();
//Display overlay dialog for specify content type
displayOverlayForSpecifyContentType();
//ビデオコンテンツの場合はキャッシュ確認
if(contentType == ContentTypeKeys.Type_Video){
//ファイルシステムが有効であればキャッシュ確認
if( CONTENTVIEW_FILESYSTEM.fs == null ){
//Display overlay dialog for specify content type
displayOverlayForSpecifyContentType(null);
} else {
var resourceId = CONTENTVIEW.getVideoContentResourceId(contentID);
//キャッシュが存在するか確認
var fileName = contentID + "/res_" + resourceId + ".dat";
CONTENTVIEW_FILESYSTEM.fs.root.getFile('/abook/' + fileName, { create: false },
function(fileEntry){
fileEntry.file(
function(file){
var url = window.URL || window.webkitURL;
var resSrc = url.createObjectURL(file);
console.log("read cache: createObjectURL " + resSrc);
displayOverlayForSpecifyContentType(resSrc);
}
);
},
function(err){ // 失敗時のコールバック関数
console.log("NotRead FileSystem");
//キャッシュ化
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if (this.readyState == 4 && this.status == 200){
CONTENTVIEW_FILESYSTEM.isXhrBusy = false;
$('#divImageLoading').css('display', 'none');
//this.response is what you're looking for
console.log(this.response, typeof this.response);
CONTENTVIEW_FILESYSTEM.fs.root.getFile(
'/abook/' + fileName,
{create: true},
function(fileEntry){
fileEntry.createWriter(
function(fileWriter) {
fileWriter.onwriteend = function(e) {
console.log('RES書き込み完了');
};
fileWriter.onerror = function(e) {
console.log('RES書き込みエラー: ' + e.toString());
};
var blobData = new Blob([xhr.response], {type:"application/octet-stream"});
fileWriter.write(blobData);
}
);
},
CONTENTVIEW_FILESYSTEM.errorHandler
);
} else {
if( this.readyState == 2 ){
console.log("onreadystatechange:" + this.readyState + " " + this.status);
CONTENTVIEW_FILESYSTEM.isXhrBusy = true;
$('#divImageLoading').css('z-index', '99999');
$('#divImageLoading').css('display', 'block');
}
//console.log("onreadystatechange:" + this.readyState + " " + this.status);
}
};
var resourceUrl = downloadResourceById(contentID);
if( !CONTENTVIEW_FILESYSTEM.isXhrBusy ){
xhr.open('GET', resourceUrl);
xhr.responseType = 'blob';
xhr.send();
} else {
console.log("xhr is busy.");
}
//タグは書き出し
displayOverlayForSpecifyContentType(resourceUrl);
}
);
}
} else {
//Display overlay dialog for specify content type
displayOverlayForSpecifyContentType(null);
}
//Resize window
$(window).resize(function () {
//Check if content is zooming
if(isZoomingContent){
//var $container = $("#dialog");
// var w = window.innerWidth;
//var h = window.innerHeight;
//$container.css('height', h);
//$container.css('width', w);
}
}
});
handleSliderBar();
......@@ -628,6 +717,7 @@ function initPageMediaAndHtmlType(){
}
disable('#txtSearch', '#txtSlider');
};
//Start: Function: No.4 - Editor : Long - Date : 08/09/2013 - Summary : Create next and previous canvas
......
......@@ -48,9 +48,7 @@ var isShowBookShelf = null;
var showNextRecordClickNumber = 1;
$(document).ready(function () {
HOME.ready();
});
......@@ -58,7 +56,7 @@ $(document).ready(function () {
//$(document).ready(function () {
HOME.ready = function(){
console.log("HOME.ready!");
//console.log("HOME.ready!");
if (!avwCheckLogin(ScreenIds.Login)) {
return;
......@@ -2290,9 +2288,6 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) {
var resizeImg = resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]);
imgIconNew.onload = function () {
console.log("imgIconNew.onload..1");
ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment