Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_android
abook_check
Commits
eb84ed53
Commit
eb84ed53
authored
May 26, 2021
by
Lee Munkyeong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
動画エンコード実装
parent
d8023f43
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
25 deletions
+26
-25
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebViewActivity.java
+16
-17
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/VideoEncoder.java
+10
-8
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ChatWebViewActivity.java
View file @
eb84ed53
...
...
@@ -792,12 +792,12 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
return
;
}
/*
mChatWebView.post(new Runnable() {
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:CHAT_UI.showLoadingIndicator();"
);
}
});
*/
});
if
(
dataUri
!=
null
)
{
Cursor
cursor
=
getContentResolver
().
query
(
dataUri
,
null
,
null
,
null
,
null
);
...
...
@@ -807,28 +807,27 @@ public class ChatWebViewActivity extends CommunicationWebViewActivity {
cursor
.
close
();
Runnable
r
=
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
//CallBack
Runnable
callBack
=
new
Runnable
()
{
@Override
public
void
run
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:CHAT_UI.videoEncodeEnd('"
+
encodedFilePath
+
"')"
);
}
});
}
};
Context
c
=
getApplicationContext
();
File
file
=
new
File
(
filePath
);
String
encodedPath
=
new
VideoEncoder
().
changeResolution
(
file
);
String
encodedPath
=
new
VideoEncoder
().
changeResolution
(
file
,
callBack
);
encodedFilePath
=
encodedPath
;
final
Uri
_uri
=
getImageContentUri
(
c
,
new
File
(
encodedPath
));
sendBroadcast
(
new
Intent
(
Intent
.
ACTION_MEDIA_SCANNER_SCAN_FILE
,
_uri
));
if
(
_uri
!=
null
)
{
// result = new Uri[]{_uri};
// TODO: send result;
encodedVideoPath
=
_uri
;
//mUploadMessage.onReceiveValue(new Uri[]{_uri});
mChatWebView
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mChatWebView
.
loadUrl
(
"javascript:CHAT_UI.videoEncodeEnd('"
+
_uri
+
"');"
);
}
});
}
}
catch
(
Throwable
throwable
)
{
throwable
.
printStackTrace
();
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/VideoEncoder.java
View file @
eb84ed53
...
...
@@ -42,7 +42,7 @@ public class VideoEncoder {
private
String
mInputFile
;
@SuppressLint
(
"LongLogTag"
)
public
String
changeResolution
(
File
f
)
throws
Throwable
{
public
String
changeResolution
(
File
f
,
Runnable
callBack
)
throws
Throwable
{
mInputFile
=
f
.
getAbsolutePath
();
String
filePath
=
mInputFile
.
substring
(
0
,
mInputFile
.
lastIndexOf
(
File
.
separator
));
...
...
@@ -64,7 +64,7 @@ public class VideoEncoder {
}
mOutputFile
=
outFile
.
getAbsolutePath
();
ChangerWrapper
.
changeResolutionInSeparatedThread
(
this
);
ChangerWrapper
.
changeResolutionInSeparatedThread
(
this
,
callBack
);
return
mOutputFile
;
}
...
...
@@ -73,22 +73,23 @@ public class VideoEncoder {
private
Throwable
mThrowable
;
private
VideoEncoder
mChanger
;
private
ChangerWrapper
(
VideoEncoder
changer
)
{
private
Runnable
mCallBack
;
private
ChangerWrapper
(
VideoEncoder
changer
,
Runnable
callBack
)
{
mChanger
=
changer
;
mCallBack
=
callBack
;
}
@Override
public
void
run
()
{
try
{
mChanger
.
prepareAndChangeResolution
();
mChanger
.
prepareAndChangeResolution
(
mCallBack
);
}
catch
(
Throwable
th
)
{
mThrowable
=
th
;
}
}
public
static
void
changeResolutionInSeparatedThread
(
VideoEncoder
encoder
)
throws
Throwable
{
ChangerWrapper
wrapper
=
new
ChangerWrapper
(
encoder
);
public
static
void
changeResolutionInSeparatedThread
(
VideoEncoder
encoder
,
Runnable
callBack
)
throws
Throwable
{
ChangerWrapper
wrapper
=
new
ChangerWrapper
(
encoder
,
callBack
);
Thread
th
=
new
Thread
(
wrapper
,
ChangerWrapper
.
class
.
getSimpleName
());
th
.
start
();
// th.join();
...
...
@@ -98,7 +99,7 @@ public class VideoEncoder {
}
}
private
void
prepareAndChangeResolution
()
throws
Exception
{
private
void
prepareAndChangeResolution
(
Runnable
callBack
)
throws
Exception
{
Exception
exception
=
null
;
MediaCodecInfo
videoCodecInfo
=
selectCodec
(
OUTPUT_VIDEO_MIME_TYPE
);
...
...
@@ -275,6 +276,7 @@ public class VideoEncoder {
exception
=
e
;
}
}
callBack
.
run
();
}
if
(
exception
!=
null
)
{
throw
exception
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment