我正试图寻找Android视频中的特定位置,因为它在行为中显示的不一致性而完全陷入困境.这是我做过的事情清单
- VideoView.Seekto一个视频转到5:19,一个视频转到5:17,另一个视频转到另一个视频5:32(326000 ms)!
- 由于VideoView不支持onSeekListener,我修改了源VideoView并添加了对它的支持.然而它并没有暂停并开始从我想要的地方寻求 - 总是有一个滞后!onSeekListener会在我希望停止之前的6秒内立即调用.在许多情况下,搜索栏显示正确的时间并突然跳回几秒钟,即使我从onSeekCompleteListener调用video.start
为什么这么不一致?在videoview中有没有明确的方法可以在几毫秒内找到你想去的地方?我知道我应该使用MediaPLayer + Surface,但由于VideoView只是两个包装器,我在源头修改它但无济于事.
我知道这一点:http://code.google.com/p/android/issues/detail?id = 9135 但是有什么方法可以绕过这个并且有一个明确的方法
1.)以毫秒为单位寻找确切的时间
2.)在确切的时间暂停和恢复?
我为我的应用添加了一个共享扩展名,例如SAMPLE(已存在于应用商店中),称为SAMPLESHARE.每当用户说拍照并试图分享它时,我希望他们通过Open In功能的视图控制器,而不是从Apple获得Post对话,基本上绕过它.所以我试图在共享扩展和我的应用程序之间分享图片,创建一个在应用程序和插件之间共享的应用程序组,然后将文件路径传递给我的应用程序的应用程序委托的openURL.
所以在我的主要应用代表中我有
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [[SAMPLEExternalFileHandler shared] handleExternalFileURL:url];
}
Run Code Online (Sandbox Code Playgroud)
如果我有一个需要打开不同流的URL文件路径,我基本上每次都会检查它.
在我的SHAREEXTENSION中,我有
#import "ShareViewController.h"
#import <MobileCoreServices/UTCoreTypes.h>
//Macro to hide post dialog or not, if defined, will be hidden, comment during debugging
#define HIDE_POST_DIALOG
@interface ShareViewController ()
@end
@implementation ShareViewController
NSUInteger m_inputItemCount = 0; // Keeps track of the number of attachments we have opened asynchronously.
NSString * m_invokeArgs = NULL; // A string to be passed to your AIR app with information about …Run Code Online (Sandbox Code Playgroud) 我有来自不同供应商的一堆Android设备.
其中一些将/ mnt/sdcard连接到内部存储,将/ mnt/extsd连接到外部存储(方案1),其他人将/ mnt/sdcard连接到外部存储(方案2)
我认为第二种情况是标准的,因为Android API提供了这个路径的句柄.现在的问题是,在方案1中,/mnt/extsd成为readonly即使WRITE_EXTERNAL_STORAGE许可!
这意味着我只能从实际的外部SD卡读取数据而无法写入数据.
有没有解决方法,所以我可以写入extsd文件夹?
除了Hashtable之外,Java中的所有内容似乎都遵循大写规则.
Hashtable<String, String> ht = new Hashtable<String, String>();
Run Code Online (Sandbox Code Playgroud)
而不是
ArrayList<String> a = new ArrayList<String>();
Run Code Online (Sandbox Code Playgroud)
要么
HashMap<String,Integer> a = new HashMap<String,Integer>();
Run Code Online (Sandbox Code Playgroud)
为什么是这样 ?哈希表只读一个字(Hashtable)吗?
我正在尝试将促销子域连接到我的网站,该网站已经在https上,然后使用重定向网址重定向到网站中的另一个页面.例如,基本上如果我的网站https://example.com有一个页面,https://example.com/xyz/xyz/promo那么当我输入https://promo.example.com此页面时,我想要一个浏览器重定向.我已经设置了所有相关的AWS route 53设置.
我的nginx服务器块有这个
server {
listen 80 default_server;
listen [::]:80 default_server;
return 301 https://example.com$request_uri;
}
server {
server_name www.example.com;
return 301 https://example.com$request_uri;
}
server {
server_name example.com;
return 301 https://example.com$request_uri;
}
server {
server_name promo.example.com;
return 301 https://example.com/xyz/xyz/promo;
}
ssl_certificate /..path/..;
ssl_certificate_key //..path/..;
ssl_dhparam /..path/...;
ssl_trusted_certificate /..path/..;
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload';
ssl_prefer_server_ciphers on;
ssl_ciphers .......; //hidden
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_buffer_size 1400;
spdy_headers_comp 0;
ssl_stapling on;
ssl_stapling_verify on; …Run Code Online (Sandbox Code Playgroud) 是否可以将整个文件夹从Windows移动到Android模拟器? - 我确信这个问题的答案存在于某个地方,但我无法找到它.我可以通过adb命令行或通过ddms一次移动一个文件但是既没有让我选择移动包含多个文件夹和文件的整个文件夹,当我尝试它时给了我这个错误
C:\>adb push C:\Users\peng-lp-10\Desktop\ABC\ /mnt/sdcard/ABC/
cannot stat 'C:\Users\peng-lp-10\Desktop\ABC\': No such file or direct
ory
Run Code Online (Sandbox Code Playgroud)
即使该文件夹存在.
我在Android(Java)上解码基本64位编码图像.它适用于大多数图像,但对于某些图像二进制文件,它返回null.如果我使用在线解码器,有问题的二进制文件工作正常,这告诉我格式是正确的.
Base64.class文件中的一段代码混乱了
if (!decoder.process(input, offset, len, true)) {
throw new IllegalArgumentException("bad base-64");
}
// Maybe we got lucky and allocated exactly enough output space.
if (decoder.op == decoder.output.length) {
return decoder.output;
}
// Need to shorten the array, so allocate a new one of the
// right size and copy.
byte[] temp = new byte[decoder.op];
System.arraycopy(decoder.output, 0, temp, 0, decoder.op);
return temp;
Run Code Online (Sandbox Code Playgroud)
对于失败的图像,它会通过
也许我们得到了幸运的检查,并返回decoder.output并直接跳转到返回temp,其中inturn返回null
.但是对于有效的图像,如果并且返回非空的临时变量,则不会输入该图像.这是否存在已知问题?
UPDATE
调用代码
//This decodedString is null
byte[] decodedString = Base64.decode(
data, Base64.DEFAULT);
Bitmap setBMPPath = …Run Code Online (Sandbox Code Playgroud) 我有一个应用'A'.我正在打开另一个应用'B'的视频播放器并使用意图URI调用播放视频
String intentURI = "B://this/123";
try {
intent = Intent.parseUri(intentURI, Intent.URI_INTENT_SCHEME);
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
Logger.appendInfoLog("Something went wrong with B", TAG);
e.printStackTrace();
Logger.appendErrorLog(e.getMessage(), TAG);
finish();
}
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
现在的必要条件是该应用"B"是开放的背景为这对工作.如果应用程序被关闭(由Android或手动杀死的),或者它已崩溃,这将引发错误.
有没有办法首先打开该应用程序'B'或检查其运行状态,然后进行意图URI调用.我不会从该应用程序获得控制权,一旦我转到另一个应用程序,我就没有任何控制权,直到用户按下后退按钮返回到我的应用程序.
更新:
我想首先启动应用'B'然后以编程方式调用意图.这可能吗
UPDATE
我跑了Catlog应用程序来检查应用程序B中出现了什么消息.它只显示文件123.file(我试图在应用程序B的视频播放器中播放的那个)找不到,但是当应用程序在后台运行时它经历好.它还显示警告
java.lang.NullPointerException:PrintLn需要一条消息
然后它说
活动显示,但mediaplayer.is没有播放视频
此外,另一个应用程序是用flash编写的,并在adobe air上打包为本机应用程序
我有一个使用Rijndael的加密mp4,我用以下方式在C#中解密.
System.Security.Cryptography.Rijndael crypt = System.Security.Cryptography.Rijndael.Create();
crypt.Key = convertedSecureString;
byte[] initializationVectorLength = new byte[sizeof(int)];
CryptoStream cryptostream = new CryptoStream(inputStream, crypt.CreateDecryptor(), CryptoStreamMode.Read);
byte[] buffer = new byte[1024];
int len;
while ((len = cryptostream.Read(buffer, 0, buffer.Length)) > 0)
{
outputStream.Write(buffer, 0, len);
buffer = new byte[1024];
}
outputStream.Flush();
cryptostream.Close();
inputStream.Close();
Run Code Online (Sandbox Code Playgroud)
现在我需要将此代码转换为Java/Android等效代码.我不确定从哪里开始坦率地说.我对很多选项感到困惑 - 有人说使用Bouncy Castle,有些人说Apache Commons,有些人说是原生的Java lib.我该怎么做呢.我该怎么办CryptoStream等?
UPDATE
我在C#中使用以下代码来分配密钥
byte[] convertedSecureString = new byte[this.key.Length];
IntPtr ptr = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this.key);
for (int i = 0, j = 0; i < this.key.Length * UnicodeByteLength; i = i …Run Code Online (Sandbox Code Playgroud) 我试图'\\'用'/'java(Android)替换,这似乎不起作用!
String rawPath = filePath.replace("\\\\", "/");
Run Code Online (Sandbox Code Playgroud)
这有什么问题?我已经逃脱了"\"并试图逃避'/'但没有用.原始字符串没有任何反应.
filePath = abc\\xyz(not after escaping two \\, the original string is with two \\)
rawPath = abc \ xyz
expected = abc/xyz
Run Code Online (Sandbox Code Playgroud)
这样做的正确方法是什么?(另一个Windows文件到Android路径转换问题)