Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Video player test#1670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
jianglong0156 wants to merge10 commits intococos2d:develop
base:develop
Choose a base branch
Loading
fromjianglong0156:videoPlayerTest
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
10 commits
Select commitHold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletionsframeworks/js-bindings/bindings/Android.mk
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,6 +16,7 @@ LOCAL_SRC_FILES := auto/jsb_cocos2dx_auto.cpp \
auto/jsb_cocos2dx_ui_auto.cpp \
auto/jsb_cocos2dx_3d_auto.cpp \
auto/jsb_cocos2dx_3d_extension_auto.cpp \
auto/jsb_cocos2dx_experimental_video_auto.cpp \
manual/ScriptingCore.cpp \
manual/cocos2d_specifics.cpp \
manual/js_manual_conversions.cpp \
Expand All@@ -41,8 +42,8 @@ LOCAL_SRC_FILES := auto/jsb_cocos2dx_auto.cpp \
manual/network/XMLHTTPRequest.cpp \
manual/spine/jsb_cocos2dx_spine_manual.cpp \
manual/ui/jsb_cocos2dx_ui_manual.cpp \
manual/3d/jsb_cocos2dx_3d_manual.cpp

manual/3d/jsb_cocos2dx_3d_manual.cpp \
manual/experimental/jsb_cocos2dx_experimental_video_manual.cpp

LOCAL_CFLAGS := -DCOCOS2D_JAVASCRIPT

Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
#include "jsb_cocos2dx_experimental_video_manual.h"

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)

#include "UIVideoPlayer.h"
#include "ScriptingCore.h"
#include "cocos2d_specifics.hpp"
#include "cocos2d.h"

using namespace cocos2d;


static bool jsb_cocos2dx_experimental_ui_VideoPlayer_addEventListener(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
experimental::ui::VideoPlayer* cobj = (experimental::ui::VideoPlayer *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");

if(argc == 1){
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, obj, args.get(0)));
cobj->addEventListener([=](Ref* widget, experimental::ui::VideoPlayer::EventType type)->void{
jsval arg[2];
js_proxy_t *proxy = js_get_or_create_proxy(cx, widget);
if(proxy)
arg[0] = OBJECT_TO_JSVAL(proxy->obj);
else
arg[0] = JSVAL_NULL;
arg[1] = int32_to_jsval(cx, (int32_t)type);
JS::RootedValue rval(cx);

bool ok = func->invoke(2, arg, &rval);
if (!ok && JS_IsExceptionPending(cx)) {
JS_ReportPendingException(cx);
}
});
return true;
}
}

extern JSObject* jsb_cocos2d_experimental_ui_VideoPlayer_prototype;

void register_all_cocos2dx_experimental_video_manual(JSContext* cx, JS::HandleObject global)
{
JS_DefineFunction(cx, JS::RootedObject(cx, jsb_cocos2d_experimental_ui_VideoPlayer_prototype), "addEventListener", jsb_cocos2dx_experimental_ui_VideoPlayer_addEventListener, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
}

#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
#ifndef __jsb_cocos2dx_experimental_video_manual__
#define __jsb_cocos2dx_experimental_video_manual__

#include "jsapi.h"
#include "jsfriendapi.h"

void register_all_cocos2dx_experimental_video_manual(JSContext* cx, JS::HandleObject global);

#endif /* defined(__jsb_cocos2dx_experimental_video_manual__) */
Original file line numberDiff line numberDiff line change
Expand Up@@ -146,6 +146,12 @@
420BBCF81AA48EE900493976 /* jsb_cocos2dx_3d_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 420BBCF51AA48EE900493976 /* jsb_cocos2dx_3d_manual.cpp */; };
420BBCF91AA48EE900493976 /* jsb_cocos2dx_3d_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 420BBCF61AA48EE900493976 /* jsb_cocos2dx_3d_manual.h */; };
420BBCFA1AA48EE900493976 /* jsb_cocos2dx_3d_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 420BBCF61AA48EE900493976 /* jsb_cocos2dx_3d_manual.h */; };
4BE089C81ADF6A8200D65D4B /* jsb_cocos2dx_experimental_webView_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE089C41ADF6A8200D65D4B /* jsb_cocos2dx_experimental_webView_auto.cpp */; };
4BE089C91ADF6A8200D65D4B /* jsb_cocos2dx_experimental_webView_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 4BE089C51ADF6A8200D65D4B /* jsb_cocos2dx_experimental_webView_auto.hpp */; };
4BE089CA1ADF6A8200D65D4B /* jsb_cocos2dx_experimental_video_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE089C61ADF6A8200D65D4B /* jsb_cocos2dx_experimental_video_auto.cpp */; };
4BE089CB1ADF6A8200D65D4B /* jsb_cocos2dx_experimental_video_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 4BE089C71ADF6A8200D65D4B /* jsb_cocos2dx_experimental_video_auto.hpp */; };
4BE089D01ADF8C1800D65D4B /* jsb_cocos2dx_experimental_video_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE089CE1ADF8C1800D65D4B /* jsb_cocos2dx_experimental_video_manual.cpp */; };
4BE089D11ADF8C1800D65D4B /* jsb_cocos2dx_experimental_video_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE089CF1ADF8C1800D65D4B /* jsb_cocos2dx_experimental_video_manual.h */; };
83A5661918DA878400FC31A0 /* jsb_socketio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83A5661718DA878400FC31A0 /* jsb_socketio.cpp */; };
83A5661A18DA878400FC31A0 /* jsb_socketio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83A5661718DA878400FC31A0 /* jsb_socketio.cpp */; };
83A5661B18DA878400FC31A0 /* jsb_socketio.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A5661818DA878400FC31A0 /* jsb_socketio.h */; };
Expand DownExpand Up@@ -256,6 +262,12 @@
420BBCEF1AA48EDE00493976 /* jsb_cocos2dx_3d_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_3d_auto.hpp; sourceTree = "<group>"; };
420BBCF51AA48EE900493976 /* jsb_cocos2dx_3d_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_3d_manual.cpp; sourceTree = "<group>"; };
420BBCF61AA48EE900493976 /* jsb_cocos2dx_3d_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_cocos2dx_3d_manual.h; sourceTree = "<group>"; };
4BE089C41ADF6A8200D65D4B /* jsb_cocos2dx_experimental_webView_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_experimental_webView_auto.cpp; sourceTree = "<group>"; };
4BE089C51ADF6A8200D65D4B /* jsb_cocos2dx_experimental_webView_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_experimental_webView_auto.hpp; sourceTree = "<group>"; };
4BE089C61ADF6A8200D65D4B /* jsb_cocos2dx_experimental_video_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_experimental_video_auto.cpp; sourceTree = "<group>"; };
4BE089C71ADF6A8200D65D4B /* jsb_cocos2dx_experimental_video_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_experimental_video_auto.hpp; sourceTree = "<group>"; };
4BE089CE1ADF8C1800D65D4B /* jsb_cocos2dx_experimental_video_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_experimental_video_manual.cpp; sourceTree = "<group>"; };
4BE089CF1ADF8C1800D65D4B /* jsb_cocos2dx_experimental_video_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_cocos2dx_experimental_video_manual.h; sourceTree = "<group>"; };
83A5661718DA878400FC31A0 /* jsb_socketio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_socketio.cpp; sourceTree = "<group>"; };
83A5661818DA878400FC31A0 /* jsb_socketio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_socketio.h; sourceTree = "<group>"; };
BA4095C01A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_studio_conversions.cpp; sourceTree = "<group>"; };
Expand DownExpand Up@@ -323,6 +335,10 @@
1A119E2E18BDF19200352BAA /* auto */ = {
isa = PBXGroup;
children = (
4BE089C41ADF6A8200D65D4B /* jsb_cocos2dx_experimental_webView_auto.cpp */,
4BE089C51ADF6A8200D65D4B /* jsb_cocos2dx_experimental_webView_auto.hpp */,
4BE089C61ADF6A8200D65D4B /* jsb_cocos2dx_experimental_video_auto.cpp */,
4BE089C71ADF6A8200D65D4B /* jsb_cocos2dx_experimental_video_auto.hpp */,
420BBCEE1AA48EDE00493976 /* jsb_cocos2dx_3d_auto.cpp */,
420BBCEF1AA48EDE00493976 /* jsb_cocos2dx_3d_auto.hpp */,
BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */,
Expand All@@ -349,6 +365,7 @@
1A119E4118BDF19200352BAA /* manual */ = {
isa = PBXGroup;
children = (
4BE089CD1ADF8C1800D65D4B /* experimental */,
420BBCF41AA48EE900493976 /* 3d */,
0541A74C1973876100E45470 /* ios */,
1A119E4218BDF19200352BAA /* chipmunk */,
Expand DownExpand Up@@ -525,6 +542,15 @@
path = 3d;
sourceTree = "<group>";
};
4BE089CD1ADF8C1800D65D4B /* experimental */ = {
isa = PBXGroup;
children = (
4BE089CE1ADF8C1800D65D4B /* jsb_cocos2dx_experimental_video_manual.cpp */,
4BE089CF1ADF8C1800D65D4B /* jsb_cocos2dx_experimental_video_manual.h */,
);
path = experimental;
sourceTree = "<group>";
};
BA623DFB191A192700761F37 /* pluginx */ = {
isa = PBXGroup;
children = (
Expand DownExpand Up@@ -604,6 +630,7 @@
1A119F0218BDF19200352BAA /* ScriptingCore.h in Headers */,
1A119EBE18BDF19200352BAA /* cocos2d_specifics.hpp in Headers */,
83A5661C18DA878400FC31A0 /* jsb_socketio.h in Headers */,
4BE089CB1ADF6A8200D65D4B /* jsb_cocos2dx_experimental_video_auto.hpp in Headers */,
1A1D3B7B18C44FD000922D3C /* jsb_event_dispatcher_manual.h in Headers */,
1A119EF618BDF19200352BAA /* js_bindings_system_registration.h in Headers */,
BA4095C51A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h in Headers */,
Expand All@@ -614,6 +641,7 @@
1A119EFA18BDF19200352BAA /* jsb_websocket.h in Headers */,
1A119E9218BDF19200352BAA /* jsb_cocos2dx_extension_auto.hpp in Headers */,
1A119E8C18BDF19200352BAA /* jsb_cocos2dx_builder_auto.hpp in Headers */,
4BE089C91ADF6A8200D65D4B /* jsb_cocos2dx_experimental_webView_auto.hpp in Headers */,
BA623E19191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.hpp in Headers */,
1A119EAA18BDF19200352BAA /* js_bindings_chipmunk_auto_classes.h in Headers */,
1A119E9E18BDF19200352BAA /* jsb_cocos2dx_spine_auto.hpp in Headers */,
Expand All@@ -631,6 +659,7 @@
1AB5E63618D05BF30088DAA4 /* jsb_cocos2dx_ui_manual.h in Headers */,
1A119EE418BDF19200352BAA /* jsb_opengl_functions.h in Headers */,
BA623E10191A195F00761F37 /* jsb_pluginx_manual_protocols.h in Headers */,
4BE089D11ADF8C1800D65D4B /* jsb_cocos2dx_experimental_video_manual.h in Headers */,
1AB5E62E18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.hpp in Headers */,
1A119EDA18BDF19200352BAA /* js_bindings_opengl.h in Headers */,
1A119EC818BDF19200352BAA /* jsb_cocos2dx_studio_manual.h in Headers */,
Expand DownExpand Up@@ -768,6 +797,7 @@
1A119EEE18BDF19200352BAA /* js_bindings_system_functions.cpp in Sources */,
1A119EB418BDF19200352BAA /* js_bindings_chipmunk_manual.cpp in Sources */,
1A119EEA18BDF19200352BAA /* jsb_opengl_registration.cpp in Sources */,
4BE089CA1ADF6A8200D65D4B /* jsb_cocos2dx_experimental_video_auto.cpp in Sources */,
1A119EF818BDF19200352BAA /* jsb_websocket.cpp in Sources */,
1A119ED418BDF19200352BAA /* js_bindings_core.cpp in Sources */,
420BBCF11AA48EDE00493976 /* jsb_cocos2dx_3d_auto.cpp in Sources */,
Expand All@@ -778,9 +808,11 @@
1A119ED818BDF19200352BAA /* js_bindings_opengl.cpp in Sources */,
1AB5E62C18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.cpp in Sources */,
1A119E9C18BDF19200352BAA /* jsb_cocos2dx_spine_auto.cpp in Sources */,
4BE089C81ADF6A8200D65D4B /* jsb_cocos2dx_experimental_webView_auto.cpp in Sources */,
1A119EF418BDF19200352BAA /* js_bindings_system_registration.cpp in Sources */,
1A119EBC18BDF19200352BAA /* cocos2d_specifics.cpp in Sources */,
1A119EE618BDF19200352BAA /* jsb_opengl_manual.cpp in Sources */,
4BE089D01ADF8C1800D65D4B /* jsb_cocos2dx_experimental_video_manual.cpp in Sources */,
1A119F0618BDF19200352BAA /* jsb_cocos2dx_spine_manual.cpp in Sources */,
BA623E0F191A195F00761F37 /* jsb_pluginx_manual_protocols.cpp in Sources */,
BA623E13191A195F00761F37 /* pluginxUTF8.cpp in Sources */,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2013-2014 Chukong Technologies Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

var ccexp = ccexp || {};

ccexp.VideoPlayer.PLAYING = 0;
ccexp.VideoPlayer.PAUSED = 1;
ccexp.VideoPlayer.STOPPED = 2;
ccexp.VideoPlayer.COMPLETED = 3;
4 changes: 4 additions & 0 deletionsframeworks/js-bindings/bindings/script/jsb.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -136,4 +136,8 @@ if (jsb.Sprite3D){

if (jsb.ParticleSystem3D) {
require('script/3d/jsb_cocos2d_3d_ext.js');
}

if (window.ccexp) {
require('script/experimental/jsb_experimental.js');
}
2 changes: 2 additions & 0 deletionssamples/js-tests/project.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -168,6 +168,8 @@
"src/GUITest/UITextFieldTest/UITextFieldTest.js",
"src/GUITest/UIRichTextTest/UIRichTextTest.js",
"src/GUITest/UITextTest/UITextTest.js",
"src/GUITest/UIVideoPlayerTest/UIVideoPlayerTest.js",


"src/CocoStudioTest/SceneTest/TriggerCode/Acts.js",
"src/CocoStudioTest/SceneTest/TriggerCode/Cons.js",
Expand Down
10 changes: 10 additions & 0 deletionssamples/js-tests/project/Classes/AppDelegate.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,11 @@
#include "js_Effect3D_bindings.h"
#endif

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include "jsb_cocos2dx_experimental_video_auto.hpp"
#include "experimental/jsb_cocos2dx_experimental_video_manual.h"
#endif

USING_NS_CC;
USING_NS_CC_EXT;
using namespace CocosDenshion;
Expand DownExpand Up@@ -126,6 +131,11 @@ bool AppDelegate::applicationDidFinishLaunching()
sc->addRegisterCallback(register_Effect3D_bindings);
#endif

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
sc->addRegisterCallback(register_all_cocos2dx_experimental_video);
sc->addRegisterCallback(register_all_cocos2dx_experimental_video_manual);
#endif

sc->start();
sc->runScript("script/jsb_boot.js");
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
Expand Down
Binary file addedsamples/js-tests/res/cocosvideo.mp4
View file
Open in desktop
Binary file not shown.
8 changes: 8 additions & 0 deletionssamples/js-tests/src/GUITest/UISceneManager.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,6 +28,14 @@
var currentTestingArray = null;

var testingItems = {
"UIVideoPlayerTest": [
{
title: "UIVideoPlayerTest",
func: function () {
return new UIVideoPlayerTest();
}
}
],
"UIButton": [
{
title: "UIButtonTest",
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp