提交 cc2c4032 编写于 作者: DCloud-yyl's avatar DCloud-yyl

同步代码@HBuilderX4.34

上级 54fdf946
...@@ -32,7 +32,8 @@ ...@@ -32,7 +32,8 @@
}, },
"uni_modules": { "uni_modules": {
"dependencies": [ "dependencies": [
"uni-framework" "uni-framework",
"uni-fileSystemManager"
], ],
"uni-ext-api": { "uni-ext-api": {
"uni": { "uni": {
......
...@@ -7,7 +7,7 @@ export const createVideoContext : CreateVideoContext = function (videoId : strin ...@@ -7,7 +7,7 @@ export const createVideoContext : CreateVideoContext = function (videoId : strin
if (component == null) { if (component == null) {
const pages = getCurrentPages(); const pages = getCurrentPages();
if (pages.length > 0) { if (pages.length > 0) {
videoElement = pages[pages.length - 1].$el?.parentNode?.querySelector('#' + videoId); videoElement = pages[pages.length - 1].vm!.$el?.parentNode?.querySelector('#' + videoId);
} }
} else { } else {
videoElement = component.$el?.parentNode?.querySelector('#' + videoId); videoElement = component.$el?.parentNode?.querySelector('#' + videoId);
......
...@@ -18,16 +18,24 @@ ...@@ -18,16 +18,24 @@
import FrameLayout from 'android.widget.FrameLayout'; import FrameLayout from 'android.widget.FrameLayout';
import ViewGroup from 'android.view.ViewGroup'; import ViewGroup from 'android.view.ViewGroup';
import OnHierarchyChangeListener from 'android.view.ViewGroup.OnHierarchyChangeListener';
import View from 'android.view.View'; import View from 'android.view.View';
import OnKeyListener from 'android.view.View.OnKeyListener';
import KeyEvent from 'android.view.KeyEvent';
import WindowManager from 'android.view.WindowManager';
import TextUtils from 'android.text.TextUtils'; import TextUtils from 'android.text.TextUtils';
import JSONObject from 'org.json.JSONObject'; import JSONObject from 'org.json.JSONObject';
import MediaPlayer from "android.media.MediaPlayer"; import MediaPlayer from "android.media.MediaPlayer";
import Bitmap from 'android.graphics.Bitmap'; import Bitmap from 'android.graphics.Bitmap';
import Handler from 'android.os.Handler'; import Handler from 'android.os.Handler';
import Looper from 'android.os.Looper'; import Looper from 'android.os.Looper';
import DisplayMetrics from 'android.util.DisplayMetrics';
import Context from 'android.content.Context';
import Glide from 'com.bumptech.glide.Glide'; import Glide from 'com.bumptech.glide.Glide';
import File from 'java.io.File';
import { Danmu, RequestFullScreenOptions } from '../interface.uts'; import { Danmu, RequestFullScreenOptions } from '../interface.uts';
import { UniVideoTimeUpdateEventDetail, UniVideoFullScreenChangeEventDetail, UniVideoProgressEventDetail, UniVideoFullScreenClickEventDetail, UniVideoControlsToggleEventDetail } from '../interface.uts'; import { UniVideoTimeUpdateEventDetail, UniVideoFullScreenChangeEventDetail, UniVideoProgressEventDetail, UniVideoFullScreenClickEventDetail, UniVideoControlsToggleEventDetail } from '../interface.uts';
import { UniVideoTimeUpdateEventImpl, UniVideoFullScreenChangeEventImpl, UniVideoErrorEventImpl, UniVideoProgressEventImpl, UniVideoFullScreenClickEventImpl, UniVideoControlsToggleEventImpl } from './event.uts'; import { UniVideoTimeUpdateEventImpl, UniVideoFullScreenChangeEventImpl, UniVideoErrorEventImpl, UniVideoProgressEventImpl, UniVideoFullScreenClickEventImpl, UniVideoControlsToggleEventImpl } from './event.uts';
...@@ -37,11 +45,19 @@ ...@@ -37,11 +45,19 @@
name: "video", name: "video",
data() { data() {
return { return {
rootView: null as FrameLayout | null,
playerView: null as IjkPlayerView | null, playerView: null as IjkPlayerView | null,
currentPos: 0, currentPos: 0,
currentFrame: null as Bitmap | null, currentFrame: null as Bitmap | null,
handler: new Handler(Looper.getMainLooper()) handler: new Handler(Looper.getMainLooper()),
isEnded: false,
isFirstLayoutFinished: false,
isFullScreenChanged: false,
screenWidth: 0,
screenHeight: 0,
layoutWidth: 0,
layoutHeight: 0,
videoBox: null as FrameLayout | null,
copyPath: ''
}; };
}, },
emits: ["play", "pause", "ended", "timeupdate", "fullscreenchange", "waiting", "error", "progress", "fullscreenclick", "controlstoggle"], emits: ["play", "pause", "ended", "timeupdate", "fullscreenchange", "waiting", "error", "progress", "fullscreenclick", "controlstoggle"],
...@@ -204,13 +220,13 @@ ...@@ -204,13 +220,13 @@
}, },
"initialTime": { "initialTime": {
handler(value : number) { handler(value : number) {
if (value > 0) this.playerView?.seekTo(value as Int * 1000); if (value > 0) this.playerView?.seekTo(value.toInt() * 1000);
}, },
immediate: false immediate: false
}, },
"duration": { "duration": {
handler(value : number) { handler(value : number) {
if (value > 0) this.playerView?.setDuration(value as Int * 1000); if (value > 0) this.playerView?.setDuration(value.toInt() * 1000);
}, },
immediate: false immediate: false
}, },
...@@ -246,7 +262,7 @@ ...@@ -246,7 +262,7 @@
}, },
"direction": { "direction": {
handler(value : number) { handler(value : number) {
this.playerView?.setDirection(value as Int); this.playerView?.setDirection(value.toInt());
}, },
immediate: false immediate: false
}, },
...@@ -379,40 +395,73 @@ ...@@ -379,40 +395,73 @@
immediate: false immediate: false
} }
}, },
NVLoad() : FrameLayout { NVLoad() : IjkPlayerView {
this.rootView = new FrameLayout(this.$androidContext!); return new IjkPlayerView(this.$androidContext!);
this.playerView = new IjkPlayerView(this.$androidContext);
this.rootView?.addView(this.playerView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
return this.rootView!;
}, },
NVLoaded() { NVLoaded() {
this.playerView = this.$el;
this.playerView?.init(); this.playerView?.init();
this.playerView?.setPlayerRootView(this.$el); this.playerView?.setOnPlayerChangedListener(new OnPlayerChangedListenerImpl(this));
this.playerView?.setOnPlayerChangedListener(new OnPlayerChangedListenerImpl(this, this.playerView!)); this.playerView?.setOnInfoListener(new OnInfoListenerImpl(this));
this.playerView?.setOnInfoListener(new OnInfoListenerImpl(this, this.playerView!));
this.playerView?.setOnBufferingUpdateListener(new OnBufferingUpdateListenerImpl(this)); this.playerView?.setOnBufferingUpdateListener(new OnBufferingUpdateListenerImpl(this));
this.playerView?.setOnErrorListener(new OnErrorListenerImpl(this)); this.playerView?.setOnErrorListener(new OnErrorListenerImpl(this));
this.playerView?.setOnTextureRenderViewListener(new OnTextureRenderViewListenerImpl(this, this.playerView!)); this.playerView?.setOnTextureRenderViewListener(new OnTextureRenderViewListenerImpl(this));
this.playerView?.setOnHierarchyChangeListener(new OnHierarchyChangeListenerImpl(this));
this.playerView?.setOnKeyListener(new OnKeyListenerImpl(this));
this.playerView?.setFocusable(true);
this.playerView?.setFocusableInTouchMode(true);
},
NVLayouted() {
if (!this.isFirstLayoutFinished) {
this.isFirstLayoutFinished = true;
this.playerView?.setPlayerRootView(this.$el!.getParent() as ViewGroup);
this.layoutWidth = this.getLayoutWidth();
this.layoutHeight = this.getLayoutHeight();
const metrics = new DisplayMetrics();
(this.$androidContext!.getSystemService(Context.WINDOW_SERVICE) as WindowManager).getDefaultDisplay().getRealMetrics(metrics);
this.screenWidth = metrics.widthPixels;
this.screenHeight = metrics.heightPixels;
// 调整子组件视图层级
this.videoBox = this.playerView?.findViewWithTag<FrameLayout>("fl_video_box");
(this.playerView as IjkPlayerView).removeView(this.videoBox);
(this.playerView as IjkPlayerView).addView(this.videoBox, 0);
}
if (isFullScreenChanged) {
isFullScreenChanged = false;
if (this.playerView!.isFullscreen()) {
this.playerView?.requestFocus();
if (this.getLayoutWidth() != this.screenHeight) this.setStyleWidth(this.screenHeight.toFloat());
if (this.getLayoutHeight() != this.screenWidth) this.setStyleHeight(this.screenWidth.toFloat());
} else {
this.playerView?.clearFocus();
if (this.getLayoutWidth() != this.layoutWidth) this.setStyleWidth(this.layoutWidth.toFloat());
if (this.getLayoutHeight() != this.layoutHeight) this.setStyleHeight(this.layoutHeight.toFloat());
}
}
}, },
NVUnloaded() { // 资源回收 NVUnloaded() { // 资源回收
if (this.$el != null) { // 如果组件绑定了视图则需要在组件销毁时释放视图相关资源 if (this.$el != null) { // 如果组件绑定了视图则需要在组件销毁时释放视图相关资源
this.playerView?.onDestroy(); this.playerView?.onDestroy();
this.playerView = null; this.playerView = null;
} }
if (!this.copyPath.isEmpty()) {
const file = new File(this.copyPath);
if (file.exists()) file.delete();
}
}, },
NVRecycler() { NVRecycler() {
this.playerView = this.$el?.getChildAt(0) as IjkPlayerView; this.playerView = this.$el;
this.playerView?.reset(); this.playerView?.reset();
this.resetListener(); this.resetListener();
if (this.currentPos > 0) { if (this.currentPos > 0) {
this.runDelayed(() => { this.runDelayed(() => {
this.playerView?.hidePoster(); this.playerView?.hidePoster();
this.playerView?.showLastFrame(this.currentFrame); this.playerView?.showLastFrame(this.currentFrame);
this.playerView?.seekTo(this.currentPos as Int); this.playerView?.seekTo(this.currentPos.toInt());
}, 100); }, 100);
} }
}, },
expose: ['play', 'pause', 'seek', 'requestFullScreen', 'exitFullScreen', 'stop', 'hide', 'show', 'close', 'sendDanmu', 'playbackRate', 'currentPos', 'currentFrame'], expose: ['play', 'pause', 'seek', 'requestFullScreen', 'exitFullScreen', 'stop', 'hide', 'show', 'close', 'sendDanmu', 'playbackRate', 'currentPos', 'currentFrame', 'isEnded', 'isFirstLayoutFinished', 'isFullScreenChanged', 'videoBox'],
methods: { methods: {
/** /**
* 播放视频 * 播放视频
...@@ -435,7 +484,7 @@ ...@@ -435,7 +484,7 @@
* @param pos 跳转到的位置,单位:秒(s) * @param pos 跳转到的位置,单位:秒(s)
*/ */
seek: function (pos : number) { seek: function (pos : number) {
this.playerView?.seekTo((pos as Int) * 1000); this.playerView?.seekTo(pos.toInt() * 1000);
}, },
/** /**
* 切换到全屏 * 切换到全屏
...@@ -443,11 +492,11 @@ ...@@ -443,11 +492,11 @@
*/ */
requestFullScreen: function (options : RequestFullScreenOptions | null) { requestFullScreen: function (options : RequestFullScreenOptions | null) {
this.runOnMain(function () { this.runOnMain(function () {
let direction = -90; let direction = -1;
if (options != null) { if (options != null) {
direction = options.direction as Int; direction = options.direction ?? -1;
} }
this.playerView?.fullScreen(direction as Int); this.playerView?.fullScreen(direction.toInt());
}); });
}, },
/** /**
...@@ -502,6 +551,10 @@ ...@@ -502,6 +551,10 @@
*/ */
sendDanmu: function (danmu : Danmu) { sendDanmu: function (danmu : Danmu) {
this.runOnMain(function () { this.runOnMain(function () {
if (!this.enableDanmu) {
console.error('sendDanmu is disabled, set enable-danmu true first!');
return;
}
const data = new JSONObject(); const data = new JSONObject();
data.put('text', danmu.text); data.put('text', danmu.text);
data.put('color', danmu.color); data.put('color', danmu.color);
...@@ -522,8 +575,8 @@ ...@@ -522,8 +575,8 @@
*/ */
reload: function (autoplay : boolean) { reload: function (autoplay : boolean) {
this.runOnMain(function () { this.runOnMain(function () {
this.playerView?.setDuration(this.duration as Int * 1000); this.playerView?.setDuration(this.duration.toInt() * 1000);
this.playerView?.seekTo(this.initialTime as Int * 1000); this.playerView?.seekTo(this.initialTime.toInt() * 1000);
this.playerView?.setMutePlayer(this.playerView?.isMutePlayer() == true); this.playerView?.setMutePlayer(this.playerView?.isMutePlayer() == true);
this.playerView?.clearDanma(); this.playerView?.clearDanma();
this.playerView?.enableDanmaku(this.enableDanmu); this.playerView?.enableDanmaku(this.enableDanmu);
...@@ -538,7 +591,21 @@ ...@@ -538,7 +591,21 @@
if (src.startsWith("https://") || src.startsWith("http://") || src.startsWith("rtmp://") || src.startsWith("rtsp://")) { // 网络地址 if (src.startsWith("https://") || src.startsWith("http://") || src.startsWith("rtmp://") || src.startsWith("rtsp://")) { // 网络地址
return src; return src;
} else { // 本地地址 } else { // 本地地址
return UTSAndroid.convert2AbsFullPath(src); const path = UTSAndroid.convert2AbsFullPath(src);
if (path.startsWith('/android_asset')) {
const destDirPath = UTSAndroid.getAppContext()!.getCacheDir().getAbsolutePath() + '/uni-net-cache/video/';
const destDir = new File(destDirPath);
if (!destDir.exists()) destDir.mkdirs();
const destFilePath = destDirPath + path.substring(path.lastIndexOf('/') + 1);
const destFile = new File(destFilePath);
if (!destFile.exists()) {
destFile.createNewFile();
uni.getFileSystemManager().copyFileSync(src, destFilePath);
}
this.copyPath = destFilePath;
return destFilePath;
}
return path;
} }
}, },
/** /**
...@@ -560,11 +627,13 @@ ...@@ -560,11 +627,13 @@
* 重置监听,复用时调用 * 重置监听,复用时调用
*/ */
resetListener: function () { resetListener: function () {
this.playerView?.setOnPlayerChangedListener(new OnPlayerChangedListenerImpl(this, this.playerView!)); this.playerView?.setOnPlayerChangedListener(new OnPlayerChangedListenerImpl(this));
this.playerView?.setOnInfoListener(new OnInfoListenerImpl(this, this.playerView!)); this.playerView?.setOnInfoListener(new OnInfoListenerImpl(this));
this.playerView?.setOnBufferingUpdateListener(new OnBufferingUpdateListenerImpl(this)); this.playerView?.setOnBufferingUpdateListener(new OnBufferingUpdateListenerImpl(this));
this.playerView?.setOnErrorListener(new OnErrorListenerImpl(this)); this.playerView?.setOnErrorListener(new OnErrorListenerImpl(this));
this.playerView?.setOnTextureRenderViewListener(new OnTextureRenderViewListenerImpl(this, this.playerView!)); this.playerView?.setOnTextureRenderViewListener(new OnTextureRenderViewListenerImpl(this));
this.playerView?.setOnHierarchyChangeListener(new OnHierarchyChangeListenerImpl(this));
this.playerView?.setOnKeyListener(new OnKeyListenerImpl(this));
} }
} }
} }
...@@ -584,13 +653,13 @@ ...@@ -584,13 +653,13 @@
class OnPlayerChangedListenerImpl implements OnPlayerChangedListener { class OnPlayerChangedListenerImpl implements OnPlayerChangedListener {
private comp : UTSContainer<FrameLayout>; private comp : UTSContainer<IjkPlayerView>;
private playerView : IjkPlayerView; private playerView : IjkPlayerView;
constructor(comp : UTSContainer<FrameLayout>, playerView : IjkPlayerView) { constructor(comp : UTSContainer<IjkPlayerView>) {
super(); super();
this.comp = comp; this.comp = comp;
this.playerView = playerView; this.playerView = comp.$el!;
} }
override onChanged(type : String, msg : String) : void { override onChanged(type : String, msg : String) : void {
...@@ -599,12 +668,13 @@ ...@@ -599,12 +668,13 @@
this.comp.$emit("timeupdate", new UniVideoTimeUpdateEventImpl(JSON.parse<UniVideoTimeUpdateEventDetail>(msg)!)); this.comp.$emit("timeupdate", new UniVideoTimeUpdateEventImpl(JSON.parse<UniVideoTimeUpdateEventDetail>(msg)!));
break; break;
case "fullscreenchange": case "fullscreenchange":
(this.comp as VideoComponent).isFullScreenChanged = true;
const detail = JSON.parse<UniVideoFullScreenChangeEventDetail>(msg)!; const detail = JSON.parse<UniVideoFullScreenChangeEventDetail>(msg)!;
if (detail.fullScreen) { // 进入全屏时取消监听,避免触发暂停逻辑 if (detail.fullScreen) { // 进入全屏时取消监听,避免触发暂停逻辑
this.playerView.setOnTextureRenderViewListener(null); this.playerView.setOnTextureRenderViewListener(null);
} else { // 退出全屏时重新监听 } else { // 退出全屏时重新监听
setTimeout(() => { setTimeout(() => {
this.playerView.setOnTextureRenderViewListener(new OnTextureRenderViewListenerImpl(this.comp, this.playerView)); this.playerView.setOnTextureRenderViewListener(new OnTextureRenderViewListenerImpl(this.comp));
}, 100); }, 100);
} }
this.comp.$emit("fullscreenchange", new UniVideoFullScreenChangeEventImpl(detail)); this.comp.$emit("fullscreenchange", new UniVideoFullScreenChangeEventImpl(detail));
...@@ -613,57 +683,53 @@ ...@@ -613,57 +683,53 @@
this.comp.$emit("fullscreenclick", new UniVideoFullScreenClickEventImpl(JSON.parse<UniVideoFullScreenClickEventDetail>(msg)!)); this.comp.$emit("fullscreenclick", new UniVideoFullScreenClickEventImpl(JSON.parse<UniVideoFullScreenClickEventDetail>(msg)!));
break; break;
case "controlstoggle": case "controlstoggle":
this.comp.$emit("controlstoggle", new UniVideoControlsToggleEventImpl(JSON.parse<UniVideoControlsToggleEventDetail>(msg)!)); const detail = JSON.parse<UniVideoControlsToggleEventDetail>(msg)!;
if (detail.show && this.playerView.isFullscreen()) {
setTimeout(() => {
if (!this.playerView.isFocused()) this.playerView.requestFocus();
}, 100);
}
this.comp.$emit("controlstoggle", new UniVideoControlsToggleEventImpl(detail));
break; break;
case "error": case "error":
this.comp.$emit("error", new UniVideoErrorEventImpl(new VideoErrorImpl(100001))); this.comp.$emit("error", new UniVideoErrorEventImpl(new VideoErrorImpl(100001)));
break; break;
} }
// if (type == "fullscreenchange") {
// if (playerView?.isFullscreen() == true) {
// let container = rootView?.getChildAt(1);
// if (container == null) return;
// setTimeout(() => {
// rootView?.removeView(container);
// playerView?.addView(container);
// container?.bringToFront();
// }, 100);
// } else {
// let container = playerView?.getChildAt(1);
// if (container == null) return;
// setTimeout(() => {
// playerView?.removeView(container);
// rootView?.addView(container);
// container?.bringToFront();
// }, 100);
// }
// }
} }
} }
class OnInfoListenerImpl implements OnInfoListener { class OnInfoListenerImpl implements OnInfoListener {
private comp : UTSContainer<FrameLayout>; private comp : UTSContainer<IjkPlayerView>;
private playerView : IjkPlayerView; private playerView : IjkPlayerView;
constructor(comp : UTSContainer<FrameLayout>, playerView : IjkPlayerView) { constructor(comp : UTSContainer<IjkPlayerView>) {
super(); super();
this.comp = comp; this.comp = comp;
this.playerView = playerView; this.playerView = comp.$el!;
} }
override onInfo(iMediaPlayer : IMediaPlayer | null, status : Int, extra : Int) : boolean { override onInfo(iMediaPlayer : IMediaPlayer | null, status : Int, extra : Int) : boolean {
switch (status) { switch (status) {
case MediaPlayerParams.STATE_COMPLETED: case MediaPlayerParams.STATE_COMPLETED:
this.comp.$emit("ended", new UniEvent("ended")); this.comp.$emit("ended", new UniEvent("ended"));
(this.comp as VideoComponent).isEnded = true;
if ((this.comp as VideoComponent).loop) { if ((this.comp as VideoComponent).loop) {
let initialTime = (this.comp as VideoComponent).initialTime as Int; let initialTime = (this.comp as VideoComponent).initialTime;
if (initialTime > 0) this.playerView.seekTo(initialTime * 1000); if (initialTime > 0) this.playerView.seekTo(initialTime.toInt() * 1000);
this.playerView.start(); this.playerView.start();
(this.comp as VideoComponent).isEnded = false;
} }
break; break;
case MediaPlayerParams.STATE_PLAYING: case MediaPlayerParams.STATE_PLAYING:
this.comp.$emit("play", new UniEvent("play")); this.comp.$emit("play", new UniEvent("play"));
setTimeout(() => {
if ((this.comp as VideoComponent).isEnded) {
let initialTime = (this.comp as VideoComponent).initialTime;
if (initialTime > 0) this.playerView.seekTo(initialTime.toInt() * 1000);
(this.comp as VideoComponent).isEnded = false;
}
}, 100);
break; break;
case MediaPlayerParams.STATE_PAUSED: case MediaPlayerParams.STATE_PAUSED:
this.comp.$emit("pause", new UniEvent("pause")); this.comp.$emit("pause", new UniEvent("pause"));
...@@ -682,9 +748,9 @@ ...@@ -682,9 +748,9 @@
class OnBufferingUpdateListenerImpl implements OnBufferingUpdateListener { class OnBufferingUpdateListenerImpl implements OnBufferingUpdateListener {
private comp : UTSContainer<FrameLayout>; private comp : UTSContainer<IjkPlayerView>;
constructor(comp : UTSContainer<FrameLayout>) { constructor(comp : UTSContainer<IjkPlayerView>) {
super(); super();
this.comp = comp; this.comp = comp;
} }
...@@ -699,9 +765,9 @@ ...@@ -699,9 +765,9 @@
class OnErrorListenerImpl implements OnErrorListener { class OnErrorListenerImpl implements OnErrorListener {
private comp : UTSContainer<FrameLayout>; private comp : UTSContainer<IjkPlayerView>;
constructor(comp : UTSContainer<FrameLayout>) { constructor(comp : UTSContainer<IjkPlayerView>) {
super(); super();
this.comp = comp; this.comp = comp;
} }
...@@ -718,13 +784,13 @@ ...@@ -718,13 +784,13 @@
class OnTextureRenderViewListenerImpl implements OnTextureRenderViewListener { class OnTextureRenderViewListenerImpl implements OnTextureRenderViewListener {
private comp : UTSContainer<FrameLayout>; private comp : UTSContainer<IjkPlayerView>;
private playerView : IjkPlayerView; private playerView : IjkPlayerView;
constructor(comp : UTSContainer<FrameLayout>, playerView : IjkPlayerView) { constructor(comp : UTSContainer<IjkPlayerView>) {
super(); super();
this.comp = comp; this.comp = comp;
this.playerView = playerView; this.playerView = comp.$el!;
} }
override onDetachedFromWindow() : void { override onDetachedFromWindow() : void {
...@@ -732,9 +798,58 @@ ...@@ -732,9 +798,58 @@
this.playerView.pause(); this.playerView.pause();
this.playerView.setCenterPlayBntVisibility((this.comp as VideoComponent).showCenterPlayBtn); this.playerView.setCenterPlayBntVisibility((this.comp as VideoComponent).showCenterPlayBtn);
(this.comp as VideoComponent).currentPos = this.playerView.getCurPosition(); (this.comp as VideoComponent).currentPos = this.playerView.getCurPosition();
(this.comp as VideoComponent).currentFrame?.recycle(); const frame = this.playerView.captureFrame();
(this.comp as VideoComponent).currentFrame = this.playerView.captureFrame(); (this.comp as VideoComponent).currentFrame = frame;
this.playerView.showLastFrame(frame);
} }
} }
} }
class OnHierarchyChangeListenerImpl implements OnHierarchyChangeListener {
private comp : UTSContainer<IjkPlayerView>;
private playerView : IjkPlayerView;
constructor(comp : UTSContainer<IjkPlayerView>) {
super();
this.comp = comp;
this.playerView = comp.$el!;
}
override onChildViewAdded(parent : View, child : View) : void {
// 处理子组件动态添加的情况
if ((this.comp as VideoComponent).isFirstLayoutFinished) {
if (this.playerView.indexOfChild((this.comp as VideoComponent).videoBox) != 0) {
this.playerView.removeView((this.comp as VideoComponent).videoBox);
this.playerView.addView((this.comp as VideoComponent).videoBox, 0);
}
}
}
override onChildViewRemoved(parent : View, child : View) : void {
}
}
class OnKeyListenerImpl implements OnKeyListener {
private comp : UTSContainer<IjkPlayerView>;
private playerView : IjkPlayerView;
constructor(comp : UTSContainer<IjkPlayerView>) {
super();
this.comp = comp;
this.playerView = comp.$el!;
}
override onKey(v : View, keyCode : Int, event : KeyEvent) : Boolean {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
if (this.playerView.isFullscreen()) {
(this.comp as VideoComponent).exitFullScreen();
return true;
}
}
return false;
}
}
</script> </script>
\ No newline at end of file
#if 0 #if 0
#elif defined(__arm64__) && __arm64__ #elif defined(__arm64__) && __arm64__
// Generated by Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5) // Generated by Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
#ifndef DCUNIVIDEO_SWIFT_H #ifndef DCUNIVIDEO_SWIFT_H
#define DCUNIVIDEO_SWIFT_H #define DCUNIVIDEO_SWIFT_H
#pragma clang diagnostic push #pragma clang diagnostic push
...@@ -339,6 +339,15 @@ SWIFT_CLASS("_TtC10DCUniVideo13HJDanmakuView") ...@@ -339,6 +339,15 @@ SWIFT_CLASS("_TtC10DCUniVideo13HJDanmakuView")
SWIFT_CLASS("_TtC10DCUniVideo23UniMonitoredContentView")
@interface UniMonitoredContentView : UIView
- (nonnull instancetype)initWithFrame:(CGRect)frame SWIFT_UNAVAILABLE;
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
- (void)didAddSubview:(UIView * _Nonnull)subview;
- (void)layoutSubviews;
@end
SWIFT_CLASS("_TtC10DCUniVideo20UniVideoPlayerConfig") SWIFT_CLASS("_TtC10DCUniVideo20UniVideoPlayerConfig")
@interface UniVideoPlayerConfig : NSObject @interface UniVideoPlayerConfig : NSObject
- (nonnull instancetype)init SWIFT_UNAVAILABLE; - (nonnull instancetype)init SWIFT_UNAVAILABLE;
......
// swift-interface-format-version: 1.0 // swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5) // swift-compiler-version: Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
// swift-module-flags: -target arm64-apple-ios12.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniVideo // swift-module-flags: -target arm64-apple-ios12.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-bare-slash-regex -module-name DCUniVideo
// swift-module-flags-ignorable: -enable-bare-slash-regex
import AVFAudio import AVFAudio
import AVFoundation import AVFoundation
import CommonCrypto import CommonCrypto
...@@ -58,6 +57,8 @@ public protocol UniVideoPlayerProtocol : AnyObject { ...@@ -58,6 +57,8 @@ public protocol UniVideoPlayerProtocol : AnyObject {
func getCurrentUA() -> Swift.String func getCurrentUA() -> Swift.String
func sendEvent(_ name: Swift.String, _ params: [Swift.String : Any]?) func sendEvent(_ name: Swift.String, _ params: [Swift.String : Any]?)
func loadImage(_ url: Swift.String, _ complete: @escaping (UIKit.UIImage) -> Swift.Void) func loadImage(_ url: Swift.String, _ complete: @escaping (UIKit.UIImage) -> Swift.Void)
func videoPlayerWillEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerWillExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation) func videoPlayerExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation) func videoPlayerEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func lockScreen() func lockScreen()
...@@ -71,6 +72,11 @@ public protocol UniVideoPlayerProtocol : AnyObject { ...@@ -71,6 +72,11 @@ public protocol UniVideoPlayerProtocol : AnyObject {
func workRootPath() -> Swift.String func workRootPath() -> Swift.String
func videoCacheDir() -> Swift.String func videoCacheDir() -> Swift.String
} }
@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class UniMonitoredContentView : UIKit.UIView {
@_Concurrency.MainActor(unsafe) @objc override dynamic public func didAddSubview(_ subview: UIKit.UIView)
@_Concurrency.MainActor(unsafe) @objc override dynamic public func layoutSubviews()
@objc deinit
}
final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
public typealias View = DCUniVideo.UniVideoPlayerView public typealias View = DCUniVideo.UniVideoPlayerView
final public var view: DCUniVideo.UniVideoPlayerViewPresent.View final public var view: DCUniVideo.UniVideoPlayerViewPresent.View
...@@ -79,7 +85,7 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { ...@@ -79,7 +85,7 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
get get
set set
} }
final public var contentView: UIKit.UIView { final public var contentView: DCUniVideo.UniMonitoredContentView {
get get
set set
} }
...@@ -87,6 +93,9 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { ...@@ -87,6 +93,9 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
@objc deinit @objc deinit
final public func updateViewFrame(_ rect: CoreFoundation.CGRect) final public func updateViewFrame(_ rect: CoreFoundation.CGRect)
} }
extension DCUniVideo.UniVideoPlayerViewPresent {
final public func onVideoComponentReused(_ config: DCUniVideo.UniVideoPlayerConfig)
}
extension DCUniVideo.UniVideoPlayerViewPresent { extension DCUniVideo.UniVideoPlayerViewPresent {
final public func play() final public func play()
final public func pause() final public func pause()
......
// swift-interface-format-version: 1.0 // swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5) // swift-compiler-version: Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
// swift-module-flags: -target arm64-apple-ios12.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniVideo // swift-module-flags: -target arm64-apple-ios12.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-bare-slash-regex -module-name DCUniVideo
// swift-module-flags-ignorable: -enable-bare-slash-regex
import AVFAudio import AVFAudio
import AVFoundation import AVFoundation
import CommonCrypto import CommonCrypto
...@@ -58,6 +57,8 @@ public protocol UniVideoPlayerProtocol : AnyObject { ...@@ -58,6 +57,8 @@ public protocol UniVideoPlayerProtocol : AnyObject {
func getCurrentUA() -> Swift.String func getCurrentUA() -> Swift.String
func sendEvent(_ name: Swift.String, _ params: [Swift.String : Any]?) func sendEvent(_ name: Swift.String, _ params: [Swift.String : Any]?)
func loadImage(_ url: Swift.String, _ complete: @escaping (UIKit.UIImage) -> Swift.Void) func loadImage(_ url: Swift.String, _ complete: @escaping (UIKit.UIImage) -> Swift.Void)
func videoPlayerWillEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerWillExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation) func videoPlayerExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation) func videoPlayerEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func lockScreen() func lockScreen()
...@@ -71,6 +72,11 @@ public protocol UniVideoPlayerProtocol : AnyObject { ...@@ -71,6 +72,11 @@ public protocol UniVideoPlayerProtocol : AnyObject {
func workRootPath() -> Swift.String func workRootPath() -> Swift.String
func videoCacheDir() -> Swift.String func videoCacheDir() -> Swift.String
} }
@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class UniMonitoredContentView : UIKit.UIView {
@_Concurrency.MainActor(unsafe) @objc override dynamic public func didAddSubview(_ subview: UIKit.UIView)
@_Concurrency.MainActor(unsafe) @objc override dynamic public func layoutSubviews()
@objc deinit
}
final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
public typealias View = DCUniVideo.UniVideoPlayerView public typealias View = DCUniVideo.UniVideoPlayerView
final public var view: DCUniVideo.UniVideoPlayerViewPresent.View final public var view: DCUniVideo.UniVideoPlayerViewPresent.View
...@@ -79,7 +85,7 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { ...@@ -79,7 +85,7 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
get get
set set
} }
final public var contentView: UIKit.UIView { final public var contentView: DCUniVideo.UniMonitoredContentView {
get get
set set
} }
...@@ -87,6 +93,9 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { ...@@ -87,6 +93,9 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
@objc deinit @objc deinit
final public func updateViewFrame(_ rect: CoreFoundation.CGRect) final public func updateViewFrame(_ rect: CoreFoundation.CGRect)
} }
extension DCUniVideo.UniVideoPlayerViewPresent {
final public func onVideoComponentReused(_ config: DCUniVideo.UniVideoPlayerConfig)
}
extension DCUniVideo.UniVideoPlayerViewPresent { extension DCUniVideo.UniVideoPlayerViewPresent {
final public func play() final public func play()
final public func pause() final public func pause()
......
#if 0 #if 0
#elif defined(__arm64__) && __arm64__ #elif defined(__arm64__) && __arm64__
// Generated by Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5) // Generated by Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
#ifndef DCUNIVIDEO_SWIFT_H #ifndef DCUNIVIDEO_SWIFT_H
#define DCUNIVIDEO_SWIFT_H #define DCUNIVIDEO_SWIFT_H
#pragma clang diagnostic push #pragma clang diagnostic push
...@@ -339,6 +339,15 @@ SWIFT_CLASS("_TtC10DCUniVideo13HJDanmakuView") ...@@ -339,6 +339,15 @@ SWIFT_CLASS("_TtC10DCUniVideo13HJDanmakuView")
SWIFT_CLASS("_TtC10DCUniVideo23UniMonitoredContentView")
@interface UniMonitoredContentView : UIView
- (nonnull instancetype)initWithFrame:(CGRect)frame SWIFT_UNAVAILABLE;
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
- (void)didAddSubview:(UIView * _Nonnull)subview;
- (void)layoutSubviews;
@end
SWIFT_CLASS("_TtC10DCUniVideo20UniVideoPlayerConfig") SWIFT_CLASS("_TtC10DCUniVideo20UniVideoPlayerConfig")
@interface UniVideoPlayerConfig : NSObject @interface UniVideoPlayerConfig : NSObject
- (nonnull instancetype)init SWIFT_UNAVAILABLE; - (nonnull instancetype)init SWIFT_UNAVAILABLE;
...@@ -373,7 +382,7 @@ SWIFT_CLASS("_TtC10DCUniVideo18UniVideoPlayerView") ...@@ -373,7 +382,7 @@ SWIFT_CLASS("_TtC10DCUniVideo18UniVideoPlayerView")
#endif #endif
#elif defined(__x86_64__) && __x86_64__ #elif defined(__x86_64__) && __x86_64__
// Generated by Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5) // Generated by Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
#ifndef DCUNIVIDEO_SWIFT_H #ifndef DCUNIVIDEO_SWIFT_H
#define DCUNIVIDEO_SWIFT_H #define DCUNIVIDEO_SWIFT_H
#pragma clang diagnostic push #pragma clang diagnostic push
...@@ -712,6 +721,15 @@ SWIFT_CLASS("_TtC10DCUniVideo13HJDanmakuView") ...@@ -712,6 +721,15 @@ SWIFT_CLASS("_TtC10DCUniVideo13HJDanmakuView")
SWIFT_CLASS("_TtC10DCUniVideo23UniMonitoredContentView")
@interface UniMonitoredContentView : UIView
- (nonnull instancetype)initWithFrame:(CGRect)frame SWIFT_UNAVAILABLE;
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
- (void)didAddSubview:(UIView * _Nonnull)subview;
- (void)layoutSubviews;
@end
SWIFT_CLASS("_TtC10DCUniVideo20UniVideoPlayerConfig") SWIFT_CLASS("_TtC10DCUniVideo20UniVideoPlayerConfig")
@interface UniVideoPlayerConfig : NSObject @interface UniVideoPlayerConfig : NSObject
- (nonnull instancetype)init SWIFT_UNAVAILABLE; - (nonnull instancetype)init SWIFT_UNAVAILABLE;
......
// swift-interface-format-version: 1.0 // swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5) // swift-compiler-version: Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
// swift-module-flags: -target arm64-apple-ios12.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniVideo // swift-module-flags: -target arm64-apple-ios12.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-bare-slash-regex -module-name DCUniVideo
// swift-module-flags-ignorable: -enable-bare-slash-regex
import AVFAudio import AVFAudio
import AVFoundation import AVFoundation
import CommonCrypto import CommonCrypto
...@@ -58,6 +57,8 @@ public protocol UniVideoPlayerProtocol : AnyObject { ...@@ -58,6 +57,8 @@ public protocol UniVideoPlayerProtocol : AnyObject {
func getCurrentUA() -> Swift.String func getCurrentUA() -> Swift.String
func sendEvent(_ name: Swift.String, _ params: [Swift.String : Any]?) func sendEvent(_ name: Swift.String, _ params: [Swift.String : Any]?)
func loadImage(_ url: Swift.String, _ complete: @escaping (UIKit.UIImage) -> Swift.Void) func loadImage(_ url: Swift.String, _ complete: @escaping (UIKit.UIImage) -> Swift.Void)
func videoPlayerWillEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerWillExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation) func videoPlayerExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation) func videoPlayerEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func lockScreen() func lockScreen()
...@@ -71,6 +72,11 @@ public protocol UniVideoPlayerProtocol : AnyObject { ...@@ -71,6 +72,11 @@ public protocol UniVideoPlayerProtocol : AnyObject {
func workRootPath() -> Swift.String func workRootPath() -> Swift.String
func videoCacheDir() -> Swift.String func videoCacheDir() -> Swift.String
} }
@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class UniMonitoredContentView : UIKit.UIView {
@_Concurrency.MainActor(unsafe) @objc override dynamic public func didAddSubview(_ subview: UIKit.UIView)
@_Concurrency.MainActor(unsafe) @objc override dynamic public func layoutSubviews()
@objc deinit
}
final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
public typealias View = DCUniVideo.UniVideoPlayerView public typealias View = DCUniVideo.UniVideoPlayerView
final public var view: DCUniVideo.UniVideoPlayerViewPresent.View final public var view: DCUniVideo.UniVideoPlayerViewPresent.View
...@@ -79,7 +85,7 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { ...@@ -79,7 +85,7 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
get get
set set
} }
final public var contentView: UIKit.UIView { final public var contentView: DCUniVideo.UniMonitoredContentView {
get get
set set
} }
...@@ -87,6 +93,9 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { ...@@ -87,6 +93,9 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
@objc deinit @objc deinit
final public func updateViewFrame(_ rect: CoreFoundation.CGRect) final public func updateViewFrame(_ rect: CoreFoundation.CGRect)
} }
extension DCUniVideo.UniVideoPlayerViewPresent {
final public func onVideoComponentReused(_ config: DCUniVideo.UniVideoPlayerConfig)
}
extension DCUniVideo.UniVideoPlayerViewPresent { extension DCUniVideo.UniVideoPlayerViewPresent {
final public func play() final public func play()
final public func pause() final public func pause()
......
// swift-interface-format-version: 1.0 // swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5) // swift-compiler-version: Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
// swift-module-flags: -target arm64-apple-ios12.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniVideo // swift-module-flags: -target arm64-apple-ios12.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-bare-slash-regex -module-name DCUniVideo
// swift-module-flags-ignorable: -enable-bare-slash-regex
import AVFAudio import AVFAudio
import AVFoundation import AVFoundation
import CommonCrypto import CommonCrypto
...@@ -58,6 +57,8 @@ public protocol UniVideoPlayerProtocol : AnyObject { ...@@ -58,6 +57,8 @@ public protocol UniVideoPlayerProtocol : AnyObject {
func getCurrentUA() -> Swift.String func getCurrentUA() -> Swift.String
func sendEvent(_ name: Swift.String, _ params: [Swift.String : Any]?) func sendEvent(_ name: Swift.String, _ params: [Swift.String : Any]?)
func loadImage(_ url: Swift.String, _ complete: @escaping (UIKit.UIImage) -> Swift.Void) func loadImage(_ url: Swift.String, _ complete: @escaping (UIKit.UIImage) -> Swift.Void)
func videoPlayerWillEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerWillExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation) func videoPlayerExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation) func videoPlayerEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func lockScreen() func lockScreen()
...@@ -71,6 +72,11 @@ public protocol UniVideoPlayerProtocol : AnyObject { ...@@ -71,6 +72,11 @@ public protocol UniVideoPlayerProtocol : AnyObject {
func workRootPath() -> Swift.String func workRootPath() -> Swift.String
func videoCacheDir() -> Swift.String func videoCacheDir() -> Swift.String
} }
@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class UniMonitoredContentView : UIKit.UIView {
@_Concurrency.MainActor(unsafe) @objc override dynamic public func didAddSubview(_ subview: UIKit.UIView)
@_Concurrency.MainActor(unsafe) @objc override dynamic public func layoutSubviews()
@objc deinit
}
final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
public typealias View = DCUniVideo.UniVideoPlayerView public typealias View = DCUniVideo.UniVideoPlayerView
final public var view: DCUniVideo.UniVideoPlayerViewPresent.View final public var view: DCUniVideo.UniVideoPlayerViewPresent.View
...@@ -79,7 +85,7 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { ...@@ -79,7 +85,7 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
get get
set set
} }
final public var contentView: UIKit.UIView { final public var contentView: DCUniVideo.UniMonitoredContentView {
get get
set set
} }
...@@ -87,6 +93,9 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { ...@@ -87,6 +93,9 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
@objc deinit @objc deinit
final public func updateViewFrame(_ rect: CoreFoundation.CGRect) final public func updateViewFrame(_ rect: CoreFoundation.CGRect)
} }
extension DCUniVideo.UniVideoPlayerViewPresent {
final public func onVideoComponentReused(_ config: DCUniVideo.UniVideoPlayerConfig)
}
extension DCUniVideo.UniVideoPlayerViewPresent { extension DCUniVideo.UniVideoPlayerViewPresent {
final public func play() final public func play()
final public func pause() final public func pause()
......
// swift-interface-format-version: 1.0 // swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5) // swift-compiler-version: Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
// swift-module-flags: -target x86_64-apple-ios12.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniVideo // swift-module-flags: -target x86_64-apple-ios12.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-bare-slash-regex -module-name DCUniVideo
// swift-module-flags-ignorable: -enable-bare-slash-regex
import AVFAudio import AVFAudio
import AVFoundation import AVFoundation
import CommonCrypto import CommonCrypto
...@@ -58,6 +57,8 @@ public protocol UniVideoPlayerProtocol : AnyObject { ...@@ -58,6 +57,8 @@ public protocol UniVideoPlayerProtocol : AnyObject {
func getCurrentUA() -> Swift.String func getCurrentUA() -> Swift.String
func sendEvent(_ name: Swift.String, _ params: [Swift.String : Any]?) func sendEvent(_ name: Swift.String, _ params: [Swift.String : Any]?)
func loadImage(_ url: Swift.String, _ complete: @escaping (UIKit.UIImage) -> Swift.Void) func loadImage(_ url: Swift.String, _ complete: @escaping (UIKit.UIImage) -> Swift.Void)
func videoPlayerWillEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerWillExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation) func videoPlayerExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation) func videoPlayerEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func lockScreen() func lockScreen()
...@@ -71,6 +72,11 @@ public protocol UniVideoPlayerProtocol : AnyObject { ...@@ -71,6 +72,11 @@ public protocol UniVideoPlayerProtocol : AnyObject {
func workRootPath() -> Swift.String func workRootPath() -> Swift.String
func videoCacheDir() -> Swift.String func videoCacheDir() -> Swift.String
} }
@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class UniMonitoredContentView : UIKit.UIView {
@_Concurrency.MainActor(unsafe) @objc override dynamic public func didAddSubview(_ subview: UIKit.UIView)
@_Concurrency.MainActor(unsafe) @objc override dynamic public func layoutSubviews()
@objc deinit
}
final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
public typealias View = DCUniVideo.UniVideoPlayerView public typealias View = DCUniVideo.UniVideoPlayerView
final public var view: DCUniVideo.UniVideoPlayerViewPresent.View final public var view: DCUniVideo.UniVideoPlayerViewPresent.View
...@@ -79,7 +85,7 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { ...@@ -79,7 +85,7 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
get get
set set
} }
final public var contentView: UIKit.UIView { final public var contentView: DCUniVideo.UniMonitoredContentView {
get get
set set
} }
...@@ -87,6 +93,9 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { ...@@ -87,6 +93,9 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
@objc deinit @objc deinit
final public func updateViewFrame(_ rect: CoreFoundation.CGRect) final public func updateViewFrame(_ rect: CoreFoundation.CGRect)
} }
extension DCUniVideo.UniVideoPlayerViewPresent {
final public func onVideoComponentReused(_ config: DCUniVideo.UniVideoPlayerConfig)
}
extension DCUniVideo.UniVideoPlayerViewPresent { extension DCUniVideo.UniVideoPlayerViewPresent {
final public func play() final public func play()
final public func pause() final public func pause()
......
// swift-interface-format-version: 1.0 // swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5) // swift-compiler-version: Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
// swift-module-flags: -target x86_64-apple-ios12.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniVideo // swift-module-flags: -target x86_64-apple-ios12.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-bare-slash-regex -module-name DCUniVideo
// swift-module-flags-ignorable: -enable-bare-slash-regex
import AVFAudio import AVFAudio
import AVFoundation import AVFoundation
import CommonCrypto import CommonCrypto
...@@ -58,6 +57,8 @@ public protocol UniVideoPlayerProtocol : AnyObject { ...@@ -58,6 +57,8 @@ public protocol UniVideoPlayerProtocol : AnyObject {
func getCurrentUA() -> Swift.String func getCurrentUA() -> Swift.String
func sendEvent(_ name: Swift.String, _ params: [Swift.String : Any]?) func sendEvent(_ name: Swift.String, _ params: [Swift.String : Any]?)
func loadImage(_ url: Swift.String, _ complete: @escaping (UIKit.UIImage) -> Swift.Void) func loadImage(_ url: Swift.String, _ complete: @escaping (UIKit.UIImage) -> Swift.Void)
func videoPlayerWillEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerWillExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation) func videoPlayerExitFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func videoPlayerEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation) func videoPlayerEnterFullScreen(_ orientation: UIKit.UIInterfaceOrientation)
func lockScreen() func lockScreen()
...@@ -71,6 +72,11 @@ public protocol UniVideoPlayerProtocol : AnyObject { ...@@ -71,6 +72,11 @@ public protocol UniVideoPlayerProtocol : AnyObject {
func workRootPath() -> Swift.String func workRootPath() -> Swift.String
func videoCacheDir() -> Swift.String func videoCacheDir() -> Swift.String
} }
@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class UniMonitoredContentView : UIKit.UIView {
@_Concurrency.MainActor(unsafe) @objc override dynamic public func didAddSubview(_ subview: UIKit.UIView)
@_Concurrency.MainActor(unsafe) @objc override dynamic public func layoutSubviews()
@objc deinit
}
final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
public typealias View = DCUniVideo.UniVideoPlayerView public typealias View = DCUniVideo.UniVideoPlayerView
final public var view: DCUniVideo.UniVideoPlayerViewPresent.View final public var view: DCUniVideo.UniVideoPlayerViewPresent.View
...@@ -79,7 +85,7 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { ...@@ -79,7 +85,7 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
get get
set set
} }
final public var contentView: UIKit.UIView { final public var contentView: DCUniVideo.UniMonitoredContentView {
get get
set set
} }
...@@ -87,6 +93,9 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent { ...@@ -87,6 +93,9 @@ final public class UniVideoPlayerViewPresent : DCUniVideo.ViewPresent {
@objc deinit @objc deinit
final public func updateViewFrame(_ rect: CoreFoundation.CGRect) final public func updateViewFrame(_ rect: CoreFoundation.CGRect)
} }
extension DCUniVideo.UniVideoPlayerViewPresent {
final public func onVideoComponentReused(_ config: DCUniVideo.UniVideoPlayerConfig)
}
extension DCUniVideo.UniVideoPlayerViewPresent { extension DCUniVideo.UniVideoPlayerViewPresent {
final public func play() final public func play()
final public func pause() final public func pause()
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<dict> <dict>
<key>Headers/DCUniVideo-Swift.h</key> <key>Headers/DCUniVideo-Swift.h</key>
<data> <data>
8RtESNpNJ/MLh4AISu16ekCnNgM= 6AI8KDmmckpzHIE9MTA87TBlOEA=
</data> </data>
<key>Headers/DCUniVideo.h</key> <key>Headers/DCUniVideo.h</key>
<data> <data>
...@@ -18,55 +18,55 @@ ...@@ -18,55 +18,55 @@
</data> </data>
<key>Info.plist</key> <key>Info.plist</key>
<data> <data>
ZJfU/z0myJ2FJ6v4FI5s1po6+18= 4STIX+M3zL3GrGrwOIBZ35QNXpQ=
</data> </data>
<key>Modules/DCUniVideo.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo</key> <key>Modules/DCUniVideo.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo</key>
<data> <data>
s671NwsGj4sqwNrv8yjseGHsFcU= /CTSTQuMxlC70vyU7iOX8wGDf+4=
</data> </data>
<key>Modules/DCUniVideo.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo</key> <key>Modules/DCUniVideo.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo</key>
<data> <data>
SUkzPTBsGZ+8sMIVYanMcbgblsU= 64wiXw8pS4gsJb8AmmNjU/dce+M=
</data> </data>
<key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.abi.json</key> <key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
<data> <data>
klLCR7hwfRK0Dm3cIvcvaWCZZzE= 6g7piUV4/cufnba98Op8+kJw65E=
</data> </data>
<key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key> <key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
<data> <data>
TYzZQAPhXzOjxQ7cOKZu2E3/gOM= AT+Uc934hqQ5s7XiudgE4R+Klag=
</data> </data>
<key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key> <key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
<data> <data>
zaMs+qbaViQJV9jdtXLqo29LabM= skvNhIA0R3GI+di1j0sdu/54Jgo=
</data> </data>
<key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key> <key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
<data> <data>
TYzZQAPhXzOjxQ7cOKZu2E3/gOM= AT+Uc934hqQ5s7XiudgE4R+Klag=
</data> </data>
<key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key> <key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
<data> <data>
uNk62C0qfgyY2a5kPKZHrtvlbAs= 4WOy1OqT/1CovEL8hNH7mPVwr/U=
</data> </data>
<key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.abi.json</key> <key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
<data> <data>
klLCR7hwfRK0Dm3cIvcvaWCZZzE= 6g7piUV4/cufnba98Op8+kJw65E=
</data> </data>
<key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key> <key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
<data> <data>
P9A/XUTYbV9hqAFkvIsnL90B8HQ= 9EbVYjfn5tKvGE1pRend6D42C7g=
</data> </data>
<key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key> <key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
<data> <data>
tMymyR7BzfUWQ9cTfV/3r+zajeY= WeMQjnMJwgj3QZJ6JvPtSkLHDfw=
</data> </data>
<key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key> <key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
<data> <data>
P9A/XUTYbV9hqAFkvIsnL90B8HQ= 9EbVYjfn5tKvGE1pRend6D42C7g=
</data> </data>
<key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key> <key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
<data> <data>
JdVrKMyf2fPGYDbJBwiyyQNsIiY= 868ltQGQ9ZGE5Iyk1H7oWXmN8JY=
</data> </data>
<key>Modules/module.modulemap</key> <key>Modules/module.modulemap</key>
<data> <data>
...@@ -79,11 +79,11 @@ ...@@ -79,11 +79,11 @@
<dict> <dict>
<key>hash</key> <key>hash</key>
<data> <data>
8RtESNpNJ/MLh4AISu16ekCnNgM= 6AI8KDmmckpzHIE9MTA87TBlOEA=
</data> </data>
<key>hash2</key> <key>hash2</key>
<data> <data>
6rkDl2fzm2saIt4Lj2MYeOP5Z1dDjaCYAEu7PhIdI/k= N818DwGCZblozLzhJGHxkM9CUzR3/hgBV+b2dliE1bk=
</data> </data>
</dict> </dict>
<key>Headers/DCUniVideo.h</key> <key>Headers/DCUniVideo.h</key>
...@@ -112,132 +112,132 @@ ...@@ -112,132 +112,132 @@
<dict> <dict>
<key>hash</key> <key>hash</key>
<data> <data>
s671NwsGj4sqwNrv8yjseGHsFcU= /CTSTQuMxlC70vyU7iOX8wGDf+4=
</data> </data>
<key>hash2</key> <key>hash2</key>
<data> <data>
iYsFUpWDkvI+jUMAWo2bdH6GyvLJ76JtyNBqbS1fj6Q= mXFCGPbsKJ1JiOP54zWfFztb2vrPw+3oQonSw3l6RUc=
</data> </data>
</dict> </dict>
<key>Modules/DCUniVideo.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo</key> <key>Modules/DCUniVideo.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo</key>
<dict> <dict>
<key>hash</key> <key>hash</key>
<data> <data>
SUkzPTBsGZ+8sMIVYanMcbgblsU= 64wiXw8pS4gsJb8AmmNjU/dce+M=
</data> </data>
<key>hash2</key> <key>hash2</key>
<data> <data>
X+L51/3PeNndOSrG4xg5uOC9hCFTffd2mVN3oVUewlc= BLjUlDgXs4UIoOKdAhIC+N1JYbZpgOOlezMlmxeFbO4=
</data> </data>
</dict> </dict>
<key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.abi.json</key> <key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
<dict> <dict>
<key>hash</key> <key>hash</key>
<data> <data>
klLCR7hwfRK0Dm3cIvcvaWCZZzE= 6g7piUV4/cufnba98Op8+kJw65E=
</data> </data>
<key>hash2</key> <key>hash2</key>
<data> <data>
o4h4Z+83LVZW9r+zBFizfGQO2tO0WDOtdTR6hoN8Gvg= JQ/uRwcNEZAemsl2XxnN+U1LH2g5HWw9hODc1t6xrSk=
</data> </data>
</dict> </dict>
<key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key> <key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
<dict> <dict>
<key>hash</key> <key>hash</key>
<data> <data>
TYzZQAPhXzOjxQ7cOKZu2E3/gOM= AT+Uc934hqQ5s7XiudgE4R+Klag=
</data> </data>
<key>hash2</key> <key>hash2</key>
<data> <data>
fGUfQRyQkDydTP0YQ2ycZuJ+xLOTauxL6nBJJtVHeUo= OcfDfHnBnZ1Cc8+ED7WInmje9+thSxUDvdHE7HK2UdQ=
</data> </data>
</dict> </dict>
<key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key> <key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
<dict> <dict>
<key>hash</key> <key>hash</key>
<data> <data>
zaMs+qbaViQJV9jdtXLqo29LabM= skvNhIA0R3GI+di1j0sdu/54Jgo=
</data> </data>
<key>hash2</key> <key>hash2</key>
<data> <data>
ltXhZrQmuZPwZ/zatuXP0+KdjKP8anH8ihgjTcDuFzc= lNWH1MV4Mzre1nP4Za3ZX5YObDq5i/XHbsm1fIREytI=
</data> </data>
</dict> </dict>
<key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key> <key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
<dict> <dict>
<key>hash</key> <key>hash</key>
<data> <data>
TYzZQAPhXzOjxQ7cOKZu2E3/gOM= AT+Uc934hqQ5s7XiudgE4R+Klag=
</data> </data>
<key>hash2</key> <key>hash2</key>
<data> <data>
fGUfQRyQkDydTP0YQ2ycZuJ+xLOTauxL6nBJJtVHeUo= OcfDfHnBnZ1Cc8+ED7WInmje9+thSxUDvdHE7HK2UdQ=
</data> </data>
</dict> </dict>
<key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key> <key>Modules/DCUniVideo.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
<dict> <dict>
<key>hash</key> <key>hash</key>
<data> <data>
uNk62C0qfgyY2a5kPKZHrtvlbAs= 4WOy1OqT/1CovEL8hNH7mPVwr/U=
</data> </data>
<key>hash2</key> <key>hash2</key>
<data> <data>
KE6t/makmOA22CRGdqzqC4Jem2fk3gLT41lif5+0lo4= z+56Py2JAl94oNNpRG54OpTOYx6MytxbwujY5jTFiwc=
</data> </data>
</dict> </dict>
<key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.abi.json</key> <key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
<dict> <dict>
<key>hash</key> <key>hash</key>
<data> <data>
klLCR7hwfRK0Dm3cIvcvaWCZZzE= 6g7piUV4/cufnba98Op8+kJw65E=
</data> </data>
<key>hash2</key> <key>hash2</key>
<data> <data>
o4h4Z+83LVZW9r+zBFizfGQO2tO0WDOtdTR6hoN8Gvg= JQ/uRwcNEZAemsl2XxnN+U1LH2g5HWw9hODc1t6xrSk=
</data> </data>
</dict> </dict>
<key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key> <key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
<dict> <dict>
<key>hash</key> <key>hash</key>
<data> <data>
P9A/XUTYbV9hqAFkvIsnL90B8HQ= 9EbVYjfn5tKvGE1pRend6D42C7g=
</data> </data>
<key>hash2</key> <key>hash2</key>
<data> <data>
VzdCbPQNtj1hylfhs2PD3X4eBPdh0GAfIBhp+KSR+P4= ElH2U0ZxMym5pgUUeycsjfZ8NlPNEW7dLNFHVhUIRUk=
</data> </data>
</dict> </dict>
<key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key> <key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
<dict> <dict>
<key>hash</key> <key>hash</key>
<data> <data>
tMymyR7BzfUWQ9cTfV/3r+zajeY= WeMQjnMJwgj3QZJ6JvPtSkLHDfw=
</data> </data>
<key>hash2</key> <key>hash2</key>
<data> <data>
9dLnwDexyVteRT+z/YK1LMyqtXXzArso9N35QjFp6bU= nqCcouRnuFnUpuLy2+rb6C6BrrEytmIDxcf70dIRpyU=
</data> </data>
</dict> </dict>
<key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key> <key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
<dict> <dict>
<key>hash</key> <key>hash</key>
<data> <data>
P9A/XUTYbV9hqAFkvIsnL90B8HQ= 9EbVYjfn5tKvGE1pRend6D42C7g=
</data> </data>
<key>hash2</key> <key>hash2</key>
<data> <data>
VzdCbPQNtj1hylfhs2PD3X4eBPdh0GAfIBhp+KSR+P4= ElH2U0ZxMym5pgUUeycsjfZ8NlPNEW7dLNFHVhUIRUk=
</data> </data>
</dict> </dict>
<key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key> <key>Modules/DCUniVideo.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
<dict> <dict>
<key>hash</key> <key>hash</key>
<data> <data>
JdVrKMyf2fPGYDbJBwiyyQNsIiY= 868ltQGQ9ZGE5Iyk1H7oWXmN8JY=
</data> </data>
<key>hash2</key> <key>hash2</key>
<data> <data>
njIhZGKM17t0aLth3QCZel6b3QZzNXrf7k7ApwGl+Wo= QwlZD6edjFe9YD6Q6lQL7b23TVaPh7+GWMOLiEahBsc=
</data> </data>
</dict> </dict>
<key>Modules/module.modulemap</key> <key>Modules/module.modulemap</key>
......
<template> <template>
<view style="width: 300px;height: 225px;"> <view style="width: 300px;height: 225px;">
<slot /> <slot />
...@@ -6,9 +7,10 @@ ...@@ -6,9 +7,10 @@
<script lang="uts"> <script lang="uts">
import { UniVideoPlayerConfig, UniVideoPlayerViewPresent } from "DCUniVideo" assert { type: "implementationOnly" }; import { UniVideoPlayerConfig, UniVideoPlayerViewPresent } from "DCUniVideo" assert { type: "implementationOnly" };
import { URL, NSDictionary, CGFloat } from "Foundation"; import { URL, NSDictionary, CGFloat } from "Foundation";
import { UIImage, UIInterfaceOrientationMask, UIInterfaceOrientation, UIView } from 'UIKit'; import { UIImage, UIInterfaceOrientationMask, UIInterfaceOrientation, UIView, UIScreen, CGRect } from 'UIKit';
import { Bool, Int } from 'Swift'; import { Bool, Int } from 'Swift';
import { Danmu } from "../interface.uts" import { Danmu } from "../interface.uts";
import { UniCssFlexEdge } from "DCloudUniappRuntime";
export default { export default {
name: "video", name: "video",
...@@ -146,42 +148,42 @@ ...@@ -146,42 +148,42 @@
immediate: false immediate: false
}, },
"autoplay": { "autoplay": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("autoplay", newValue); this?.updateProp("autoplay", newValue);
}, },
immediate: false immediate: false
}, },
"loop": { "loop": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("loop", newValue); this?.updateProp("loop", newValue);
}, },
immediate: false immediate: false
}, },
"muted": { "muted": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("muted", newValue); this?.updateProp("muted", newValue);
}, },
immediate: false immediate: false
}, },
"initialTime": { "initialTime": {
handler(newValue: Number, oldValue: Number) { handler(newValue : Number, oldValue : Number) {
"[weak self]" "[weak self]"
this?.updateProp("initialTime", newValue); this?.updateProp("initialTime", newValue);
}, },
immediate: false immediate: false
}, },
"duration": { "duration": {
handler(newValue: Number, oldValue: Number) { handler(newValue : Number, oldValue : Number) {
"[weak self]" "[weak self]"
this?.updateProp("duration", newValue); this?.updateProp("duration", newValue);
}, },
immediate: false immediate: false
}, },
"controls": { "controls": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("controls", newValue); this?.updateProp("controls", newValue);
}, },
...@@ -195,140 +197,140 @@ ...@@ -195,140 +197,140 @@
immediate: false immediate: false
}, },
"danmuBtn": { "danmuBtn": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("danmuBtn", newValue); this?.updateProp("danmuBtn", newValue);
}, },
immediate: false immediate: false
}, },
"enableDanmu": { "enableDanmu": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("enableDanmu", newValue); this?.updateProp("enableDanmu", newValue);
}, },
immediate: false immediate: false
}, },
"pageGesture": { "pageGesture": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("pageGesture", newValue); this?.updateProp("pageGesture", newValue);
}, },
immediate: false immediate: false
}, },
"direction": { "direction": {
handler(newValue: Number, oldValue: Number) { handler(newValue : Number, oldValue : Number) {
"[weak self]" "[weak self]"
this?.updateProp("direction", newValue); this?.updateProp("direction", newValue);
}, },
immediate: false immediate: false
}, },
"showProgress": { "showProgress": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("showProgress", newValue); this?.updateProp("showProgress", newValue);
}, },
immediate: false immediate: false
}, },
"showFullscreenBtn": { "showFullscreenBtn": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("showFullscreenBtn", newValue); this?.updateProp("showFullscreenBtn", newValue);
}, },
immediate: false immediate: false
}, },
"showPlayBtn": { "showPlayBtn": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("showPlayBtn", newValue); this?.updateProp("showPlayBtn", newValue);
}, },
immediate: false immediate: false
}, },
"showCenterPlayBtn": { "showCenterPlayBtn": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("showCenterPlayBtn", newValue); this?.updateProp("showCenterPlayBtn", newValue);
}, },
immediate: false immediate: false
}, },
"showLoading": { "showLoading": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("showLoading", newValue); this?.updateProp("showLoading", newValue);
}, },
immediate: false immediate: false
}, },
"enableProgressGesture": { "enableProgressGesture": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("enableProgressGesture", newValue); this?.updateProp("enableProgressGesture", newValue);
}, },
immediate: false immediate: false
}, },
"objectFit": { "objectFit": {
handler(newValue: String, oldValue: String) { handler(newValue : String, oldValue : String) {
"[weak self]" "[weak self]"
this?.updateProp("objectFit", newValue); this?.updateProp("objectFit", newValue);
}, },
immediate: false immediate: false
}, },
"poster": { "poster": {
handler(newValue: String, oldValue: String) { handler(newValue : String, oldValue : String) {
"[weak self]" "[weak self]"
this?.updateProp("poster", newValue); this?.updateProp("poster", newValue);
}, },
immediate: false immediate: false
}, },
"showMuteBtn": { "showMuteBtn": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("showMuteBtn", newValue); this?.updateProp("showMuteBtn", newValue);
}, },
immediate: false immediate: false
}, },
"title": { "title": {
handler(newValue: String, oldValue: String) { handler(newValue : String, oldValue : String) {
"[weak self]" "[weak self]"
this?.updateProp("title", newValue); this?.updateProp("title", newValue);
}, },
immediate: false immediate: false
}, },
"enablePlayGesture": { "enablePlayGesture": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("enablePlayGesture", newValue); this?.updateProp("enablePlayGesture", newValue);
}, },
immediate: false immediate: false
}, },
"vslideGesture": { "vslideGesture": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("vslideGesture", newValue); this?.updateProp("vslideGesture", newValue);
}, },
immediate: false immediate: false
}, },
"vslideGestureInFullscreen": { "vslideGestureInFullscreen": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("vslideGestureInFullscreen", newValue); this?.updateProp("vslideGestureInFullscreen", newValue);
}, },
immediate: false immediate: false
}, },
"httpCache": { "httpCache": {
handler(newValue: Boolean, oldValue: Boolean) { handler(newValue : Boolean, oldValue : Boolean) {
"[weak self]" "[weak self]"
this?.updateProp("httpCache", newValue); this?.updateProp("httpCache", newValue);
}, },
immediate: false immediate: false
}, },
"codec": { "codec": {
handler(newValue: string, oldValue: string) { handler(newValue : string, oldValue : string) {
"[weak self]" "[weak self]"
this?.updateProp("codec", newValue); this?.updateProp("codec", newValue);
}, },
immediate: false immediate: false
}, },
"playStrategy": { "playStrategy": {
handler(newValue: number, oldValue: number) { handler(newValue : number, oldValue : number) {
"[weak self]" "[weak self]"
this?.updateProp("playStrategy", newValue); this?.updateProp("playStrategy", newValue);
}, },
...@@ -359,7 +361,7 @@ ...@@ -359,7 +361,7 @@
NVLoad() : UIView { NVLoad() : UIView {
if (this.present != null) { if (this.present != null) {
return this.present!.contentView; return this.present!.contentView;
} else{ } else {
return new UIView() return new UIView()
} }
}, },
...@@ -416,7 +418,7 @@ ...@@ -416,7 +418,7 @@
stop: function () { stop: function () {
this.present?.stop() this.present?.stop()
}, },
/**  /**
* 显示状态栏,仅在iOS全屏下有效 * 显示状态栏,仅在iOS全屏下有效
*/ */
showStatusBar: function () { showStatusBar: function () {
...@@ -444,8 +446,8 @@ ...@@ -444,8 +446,8 @@
this.present?.palybackRate(rate); this.present?.palybackRate(rate);
}, },
updateProp: function (key: string, value: any) { updateProp: function (key : string, value : any | null) {
DispatchQueue.main.async(execute=():void => { DispatchQueue.main.async(execute = () : void => {
this.present?.setControlValue(value, key) this.present?.setControlValue(value, key)
}) })
...@@ -455,23 +457,25 @@ ...@@ -455,23 +457,25 @@
@UTSiOS.keyword("private") @UTSiOS.keyword("private")
class DCloudUniVideoComponentDelegate implements UniVideoPlayerProtocol { class DCloudUniVideoComponentDelegate implements UniVideoPlayerProtocol {
@UTSiOS.keyword("weak") @UTSiOS.keyword("weak")
private component: VideoComponent | null = null private component : VideoComponent | null = null
private originalFrame : CGRect | null = null
constructor(component: VideoComponent) { //todotest
constructor(component : VideoComponent) {
this.component = component this.component = component
super.init() super.init()
} }
getCookieString(url: URL): string | null { getCookieString(url : URL) : string | null {
return UTSiOS.getCookieString(url) return UTSiOS.getCookieString(url)
} }
getCurrentUA(): string { getCurrentUA() : string {
return UTSiOS.getUserAgent() return UTSiOS.getUserAgent()
} }
sendEvent(name: string, params: Dictionary<string,any> | null) { sendEvent(name : string, params : Dictionary<string, any> | null) {
switch (name){ switch (name) {
case "play": case "play":
case "pause": case "pause":
case "waiting": case "waiting":
...@@ -491,8 +495,12 @@ ...@@ -491,8 +495,12 @@
} }
} }
loadImage(url: string, complete: (image: UIImage) => void) { loadImage(url : string, complete : (image : UIImage) => void) {
UTSiOS.loadImage(url, complete); UTSiOS.loadImage(url, (image, data) => {
if (image != null) {
complete(image!);
}
});
} }
lockScreen() { lockScreen() {
...@@ -503,27 +511,27 @@ ...@@ -503,27 +511,27 @@
UTSiOS.unlockScreen() UTSiOS.unlockScreen()
} }
setFullScreen(yesOrNo: boolean) { setFullScreen(yesOrNo : boolean) {
UTSiOS.setFullScreen(yesOrNo) UTSiOS.setFullScreen(yesOrNo)
} }
setHomeIndicatorAutoHidden(yesOrNo: boolean) { setHomeIndicatorAutoHidden(yesOrNo : boolean) {
UTSiOS.setHomeIndicatorAutoHidden(yesOrNo) UTSiOS.setHomeIndicatorAutoHidden(yesOrNo)
} }
setTempOrientation(temp: UIInterfaceOrientationMask) { setTempOrientation(temp : UIInterfaceOrientationMask) {
UTSiOS.setTempOrientation(temp) UTSiOS.setTempOrientation(temp)
} }
configSupportOrientation(orientation: UIInterfaceOrientation): boolean { configSupportOrientation(orientation : UIInterfaceOrientation) : boolean {
return UTSiOS.configSupportOrientation(orientation) return UTSiOS.configSupportOrientation(orientation)
} }
setDeviceInterfaceOrientation(orientation: UIInterfaceOrientation) { setDeviceInterfaceOrientation(orientation : UIInterfaceOrientation) {
UTSiOS.setDeviceInterfaceOrientation(orientation) UTSiOS.setDeviceInterfaceOrientation(orientation)
} }
h5Path2SysPath(path: string, basePath: string | null) : string { h5Path2SysPath(path : string, basePath : string | null) : string {
return UTSiOS.getResourceAbsolutePath(path, basePath) return UTSiOS.getResourceAbsolutePath(path, basePath)
} }
...@@ -531,15 +539,44 @@ ...@@ -531,15 +539,44 @@
return UTSiOS.getWorkRootPath() return UTSiOS.getWorkRootPath()
} }
videoPlayerExitFullScreen(orientation: UIInterfaceOrientation) { videoPlayerWillEnterFullScreen(orientation : UIInterfaceOrientation) {
this.originalFrame = this.component?.view.frame
const deviceSize = UIScreen.main.bounds.size
const min = min(deviceSize.width, deviceSize.height)
const max = max(deviceSize.width, deviceSize.height)
if (orientation == UIInterfaceOrientation.portrait) {
this.component?.setStyleWidth(width = Float(min))
this.component?.setStyleHeight(height = Float(max))
} else {
this.component?.setStyleWidth(width = Float(max))
this.component?.setStyleHeight(height = Float(min))
}
this.component?.domNode?.setPositionEdge(UniCssFlexEdge.top, value = -Float(this.originalFrame?.minY ?? 0))
this.component?.domNode?.setPositionEdge(UniCssFlexEdge.left, value = -Float(self.originalFrame?.minX ?? 0))
this.component?.setNeedsLayout()
}
videoPlayerWillExitFullScreen(orientation : UIInterfaceOrientation) {
if (this.originalFrame != null) {
const width = this.originalFrame!.size.width
const height = this.originalFrame!.size.height
this.component?.setStyleWidth(width = Float(width))
this.component?.setStyleHeight(height = Float(height))
this.component?.domNode?.setPositionEdge(UniCssFlexEdge.top, value = 0)
this.component?.domNode?.setPositionEdge(UniCssFlexEdge.left, value = 0)
this.component?.setNeedsLayout()
}
}
videoPlayerExitFullScreen(orientation : UIInterfaceOrientation) {
} }
videoPlayerEnterFullScreen(orientation: UIInterfaceOrientation) { videoPlayerEnterFullScreen(orientation : UIInterfaceOrientation) {
} }
videoCacheDir(): string { videoCacheDir() : string {
return UTSiOS.getVideoCacheDir() return UTSiOS.getVideoCacheDir()
} }
} }
......
...@@ -58,6 +58,11 @@ export interface VideoContext { ...@@ -58,6 +58,11 @@ export interface VideoContext {
* "osVer": "12.0", * "osVer": "12.0",
* "uniVer": "√", * "uniVer": "√",
* "unixVer": "4.11" * "unixVer": "4.11"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* } * }
* }, * },
* "web": { * "web": {
...@@ -81,6 +86,11 @@ export interface VideoContext { ...@@ -81,6 +86,11 @@ export interface VideoContext {
* "osVer": "12.0", * "osVer": "12.0",
* "uniVer": "√", * "uniVer": "√",
* "unixVer": "4.11" * "unixVer": "4.11"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* } * }
* }, * },
* "web": { * "web": {
...@@ -105,6 +115,11 @@ export interface VideoContext { ...@@ -105,6 +115,11 @@ export interface VideoContext {
* "osVer": "12.0", * "osVer": "12.0",
* "uniVer": "√", * "uniVer": "√",
* "unixVer": "4.11" * "unixVer": "4.11"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* } * }
* }, * },
* "web": { * "web": {
...@@ -128,6 +143,11 @@ export interface VideoContext { ...@@ -128,6 +143,11 @@ export interface VideoContext {
* "osVer": "12.0", * "osVer": "12.0",
* "uniVer": "√", * "uniVer": "√",
* "unixVer": "4.11" * "unixVer": "4.11"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* } * }
* }, * },
* "web": { * "web": {
...@@ -152,6 +172,11 @@ export interface VideoContext { ...@@ -152,6 +172,11 @@ export interface VideoContext {
* "osVer": "12.0", * "osVer": "12.0",
* "uniVer": "√", * "uniVer": "√",
* "unixVer": "4.11" * "unixVer": "4.11"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* } * }
* }, * },
* "web": { * "web": {
...@@ -176,6 +201,11 @@ export interface VideoContext { ...@@ -176,6 +201,11 @@ export interface VideoContext {
* "osVer": "12.0", * "osVer": "12.0",
* "uniVer": "√", * "uniVer": "√",
* "unixVer": "4.11" * "unixVer": "4.11"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* } * }
* }, * },
* "web": { * "web": {
...@@ -200,6 +230,11 @@ export interface VideoContext { ...@@ -200,6 +230,11 @@ export interface VideoContext {
* "osVer": "12.0", * "osVer": "12.0",
* "uniVer": "√", * "uniVer": "√",
* "unixVer": "4.11" * "unixVer": "4.11"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* } * }
* }, * },
* "web": { * "web": {
...@@ -224,6 +259,11 @@ export interface VideoContext { ...@@ -224,6 +259,11 @@ export interface VideoContext {
* "osVer": "12.0", * "osVer": "12.0",
* "uniVer": "√", * "uniVer": "√",
* "unixVer": "4.11" * "unixVer": "4.11"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* } * }
* }, * },
* "web": { * "web": {
...@@ -239,7 +279,6 @@ export interface VideoContext { ...@@ -239,7 +279,6 @@ export interface VideoContext {
export interface Uni { export interface Uni {
/** /**
* 创建并返回 video 上下文 videoContext 对象 * 创建并返回 video 上下文 videoContext 对象
* @description 创建并返回 video 上下文 videoContext 对象
* @uniPlatform { * @uniPlatform {
* "app": { * "app": {
* "android": { * "android": {
...@@ -251,17 +290,66 @@ export interface Uni { ...@@ -251,17 +290,66 @@ export interface Uni {
* "osVer": "12.0", * "osVer": "12.0",
* "uniVer": "√", * "uniVer": "√",
* "unixVer": "4.11" * "unixVer": "4.11"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* } * }
* }, * },
* "web": { * "web": {
* "uniVer": "√", * "uniVer": "√",
* "unixVer": "4.0" * "unixVer": "4.0"
* },
* "mp": {
* "weixin": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "alipay": {
* "hostVer": "1.10.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "baidu": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "toutiao": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "lark": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "qq": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "kuaishou": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "jd": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* }
* } * }
* } * }
* @uniVueVersion 2,3 * @uniVueVersion 2,3
* @return {VideoContext} video组件上下文对象 * @return {VideoContext} video组件上下文对象
* *
* @tutorial http://uniapp.dcloud.io/api/media/video-context?id=createVideoContext * @tutorial-uni-app https://uniapp.dcloud.net.cn/api/media/video-context.html#createvideocontext
* @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/create-video-context.html#createvideocontext
* @tutorial https://doc.dcloud.net.cn/uni-app-x/api/create-video-context.html#createvideocontext
* *
*/ */
createVideoContext : CreateVideoContext createVideoContext : CreateVideoContext
...@@ -269,12 +357,41 @@ export interface Uni { ...@@ -269,12 +357,41 @@ export interface Uni {
/** /**
* 通用事件 * 通用事件
* 临时方案,规避组件Event接口无法直接继承UniEvent的问题
*/ */
interface UniVideoEvent { interface UniVideoEvent {
/**
* 是否冒泡
*/
bubbles : boolean
/**
* 是否可以取消
*/
cancelable : boolean
/**
* 事件类型
*/
type : string type : string
target : Element | null /**
currentTarget : Element | null * 触发事件的组件
*/
target ?: UniElement | null
/**
* 当前组件
*/
currentTarget ?: UniElement | null
/**
* 事件发生时的时间戳
*/
timeStamp : Long timeStamp : Long
/**
* 阻止当前事件的进一步传播
*/
stopPropagation() : void
/**
* 阻止当前事件的默认行为
*/
preventDefault() : void
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册