This commit is contained in:
Janne Nikula 2016-07-04 14:46:08 +03:00
Родитель da6d2e543a
Коммит c8d45aa681
5 изменённых файлов: 25 добавлений и 11 удалений

Просмотреть файл

@ -9,7 +9,7 @@ android {
minSdkVersion 9
targetSdkVersion 23
versionCode = 2000
versionName = "2.0.0-beta3"
versionName = "2.0.0-beta4"
}
buildTypes {
release {

Просмотреть файл

@ -13,7 +13,7 @@ android {
minSdkVersion 9
targetSdkVersion 23
versionCode = 2000
versionName = "2.0.0-beta3"
versionName = "2.0.0-beta4"
setProperty("archivesBaseName", "unity-ads")

Просмотреть файл

@ -22,8 +22,22 @@ public final class UnityAds {
private static boolean _configurationInitialized = false;
private static boolean _debugMode = false;
/**
* An enumeration for the completion state of an ad.
*/
public enum FinishState {
ERROR, COMPLETED, SKIPPED
/**
* A state that indicates that the ad did not successfully display.
*/
ERROR,
/**
* A state that indicates that the user skipped the ad.
*/
SKIPPED,
/**
* A state that indicates that the ad was played entirely.
*/
COMPLETED
}
/**

Просмотреть файл

@ -26,7 +26,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
class CacheThreadHandler extends Handler {
class CacheThreadHandler extends Handler {
private WebRequest _currentRequest = null;
private boolean _canceled = false;
private boolean _active = false;
@ -137,12 +137,10 @@ class CacheThreadHandler extends Handler {
private void postProcessDownload(long startTime, String source, File targetFile, long byteCount, long totalBytes, boolean canceled, int responseCode, Map<String, List<String>> responseHeaders) {
long duration = SystemClock.elapsedRealtime() - startTime;
if (Build.VERSION.SDK_INT < 19) {
// With some old Androids the MediaPlayer cannot play the file unless it's set to readable for all
boolean result = targetFile.setReadable(true, false);
if (!result) {
DeviceLog.debug("Unity Ads cache: could not set file readable!");
}
// With some old Androids the MediaPlayer cannot play the file unless it's set to readable for all
boolean result = targetFile.setReadable(true, false);
if (!result) {
DeviceLog.debug("Unity Ads cache: could not set file readable!");
}
if (!canceled) {

Просмотреть файл

@ -28,12 +28,14 @@ public class VideoPlayerView extends VideoView {
_videoTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
boolean isPlaying = false;
try {
isPlaying = isPlaying();
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.VIDEOPLAYER, VideoPlayerEvent.PROGRESS, getCurrentPosition());
}
catch (IllegalStateException e) {
DeviceLog.exception("Exception while sending current position to webapp", e);
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.VIDEOPLAYER, VideoPlayerEvent.ILLEGAL_STATE, VideoPlayerEvent.PROGRESS, isPlaying());
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.VIDEOPLAYER, VideoPlayerEvent.ILLEGAL_STATE, VideoPlayerEvent.PROGRESS, isPlaying);
}
}
}, _progressEventInterval, _progressEventInterval);