player
This commit is contained in:
parent
0aa641ec0e
commit
35deccb167
|
@ -77,7 +77,7 @@ public class Prog extends AbsLayout {
|
|||
var isSimple = _program.intg("version")==2;
|
||||
if(layers==null || layers.isEmpty()) continue;
|
||||
var page = new Page();
|
||||
page.name = pageMap.str("name");
|
||||
page.name = _program.str("name");
|
||||
page.repeatTimes = pageMap.intg("repeatTimes", 1);
|
||||
page.parse(pageMap.jslist("schedules"));
|
||||
HashMap<String, SrcVideo> videoMap = new HashMap<>();
|
||||
|
@ -158,10 +158,13 @@ public class Prog extends AbsLayout {
|
|||
}
|
||||
if(src.exitDur!=0) src.exitStart = timeSpan*60/1000 - src.exitDur;
|
||||
|
||||
var id = source.stnn("id");
|
||||
var id = source.str("id");
|
||||
var fileExt = source.stnn("fileExt");
|
||||
if(id!=null && fileExt.startsWith(".") && ! new File(Util.programDir + "/" + id).exists() && new File(Util.programDir + "/" + id + fileExt).exists()) id += fileExt;
|
||||
src.view = null;
|
||||
if(src.type.equals("Image")) {
|
||||
var isGif = source.stnn("fileExt").toLowerCase().endsWith("gif");
|
||||
if(id==null) continue;
|
||||
var isGif = fileExt.toLowerCase().endsWith("gif");
|
||||
if(isGif) {
|
||||
var imgView = new GifImageView(context);
|
||||
imgView.setImageURI(src.uri = Uri.fromFile(new File(Util.programDir + "/" + id)));
|
||||
|
@ -173,6 +176,29 @@ public class Prog extends AbsLayout {
|
|||
imgView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
src.view = imgView;
|
||||
}
|
||||
} else if(src.type.endsWith("Video")) {
|
||||
var isLive = src.type.startsWith("Live");
|
||||
var url = source.str("url");
|
||||
if(isLive) {
|
||||
if(url==null) continue;
|
||||
} else if(id==null) continue;
|
||||
var key = isLive ? url : id + src.startTime + src.endTime;
|
||||
var videoView = videoMap.get(key);
|
||||
if(videoView!=null) {
|
||||
var geoOld = (AbsLayout.LayoutParams) videoView.getLayoutParams();
|
||||
if(geo.width*geo.height > geoOld.width*geoOld.height) {
|
||||
videoView.setLayoutParams(geo);
|
||||
geo = geoOld;
|
||||
}
|
||||
src.view = new SrcCopy(context, videoView);
|
||||
((SrcCopy) src.view).scaleX = 0;
|
||||
} else {
|
||||
src.view = new SrcVideo(context, isLive ? url : Util.programDir+"/"+id, source.intg("vol", 100) / 100.0f, isLive);
|
||||
videoMap.put(key, (SrcVideo) src.view);
|
||||
}
|
||||
} else if(src.type.equals("Audio")) {
|
||||
if(id==null) continue;
|
||||
src.view = new SrcVideo(context, Util.programDir + "/" +id, source.intg("vol", 100) / 100.0f, false);
|
||||
} else if(src.type.startsWith("MultiPng") || src.type.equals("SplitText")) {
|
||||
JSList<JSMap> imgs = source.jslist("arrayPics");
|
||||
if(imgs.isEmpty()) continue;
|
||||
|
@ -232,26 +258,7 @@ public class Prog extends AbsLayout {
|
|||
} else if(src.type.equals("DigitalClock")) src.view = new SrcDigitalClock(this, source);
|
||||
else if(src.type.startsWith("DigitalClock")) src.view = new SrcDigiClock(this, source);
|
||||
else if(src.type.equals("AnalogClock")) src.view = new SrcAnaClock(this, geo.width, geo.height, Util.programDir + "/" + id, source);
|
||||
else if(src.type.equals("Audio")) src.view = new SrcVideo(context, Util.programDir + "/" +id, source.intg("vol", 100) / 100.0f, false);
|
||||
else if(src.type.endsWith("Video")) {
|
||||
var isLive = src.type.startsWith("Live");
|
||||
var url = source.str("url");
|
||||
if(isLive && url==null) continue;
|
||||
var key = isLive?url:id + src.startTime + src.endTime;
|
||||
var videoView = videoMap.get(key);
|
||||
if(videoView!=null) {
|
||||
var geoOld = (AbsLayout.LayoutParams) videoView.getLayoutParams();
|
||||
if(geo.width*geo.height > geoOld.width*geoOld.height) {
|
||||
videoView.setLayoutParams(geo);
|
||||
geo = geoOld;
|
||||
}
|
||||
src.view = new SrcCopy(context, videoView);
|
||||
((SrcCopy) src.view).scaleX = 0;
|
||||
} else {
|
||||
src.view = new SrcVideo(context, isLive ? url : Util.programDir+"/"+id, source.intg("vol", 100) / 100.0f, isLive);
|
||||
videoMap.put(key, (SrcVideo) src.view);
|
||||
}
|
||||
} else if(src.type.equals("WebURL")) {
|
||||
else if(src.type.equals("WebURL")) {
|
||||
var webView = new WebView(context);
|
||||
webView.setBackgroundColor(Color.TRANSPARENT);
|
||||
webView.setVerticalScrollBarEnabled(false);
|
||||
|
|
|
@ -33,9 +33,14 @@ public class Server extends Service {
|
|||
PlayerInfo.Stub binder = new PlayerInfo.Stub() {
|
||||
@Override
|
||||
public String getProgramName() throws RemoteException {
|
||||
var name = MainActivity.ins!=null && MainActivity.ins.progView!=null && ! MainActivity.ins.progView.avas.isEmpty() ? MainActivity.ins.page(MainActivity.ins.progView.curAva).name : null;
|
||||
Util.println("Server getProgramName. <-"+name);
|
||||
return name;
|
||||
try {
|
||||
var name = MainActivity.ins!=null && MainActivity.ins.progView!=null && ! MainActivity.ins.progView.avas.isEmpty() ? MainActivity.ins.page(MainActivity.ins.progView.curAva).name : null;
|
||||
Util.println("Server getProgramName. <-"+name);
|
||||
return name;
|
||||
} catch (Exception e) {
|
||||
Util.printStackTrace(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user