Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue #4859:Add a widget to play video #6634

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions build/cocos2d_libs.xcodeproj/project.pbxproj
Expand Up @@ -1123,6 +1123,8 @@
3E26D40518ACB5D100834404 /* CCImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E26D40418ACB5D100834404 /* CCImage.cpp */; };
3E26D40618ACB5D100834404 /* CCImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E26D40418ACB5D100834404 /* CCImage.cpp */; };
3E26D40818ACB63900834404 /* CCDevice.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3E26D40718ACB63900834404 /* CCDevice.mm */; };
3EA0FB5B191B92CC00B170C8 /* UIVideoWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EA0FB59191B92CC00B170C8 /* UIVideoWidget.h */; };
3EA0FB5C191B92CC00B170C8 /* UIVideoWidgetIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3EA0FB5A191B92CC00B170C8 /* UIVideoWidgetIOS.mm */; };
460E468118080832000CDD6D /* cocos-ext.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A167D21807AF4D005B8026 /* cocos-ext.h */; };
460E468218080836000CDD6D /* cocos-ext.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A167D21807AF4D005B8026 /* cocos-ext.h */; };
460E477B180808F5000CDD6D /* ExtensionMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A168321807AF4E005B8026 /* ExtensionMacros.h */; };
Expand Down Expand Up @@ -2314,6 +2316,8 @@
37936A3E1869B76800E974DD /* writer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = writer.h; sourceTree = "<group>"; };
3E26D40418ACB5D100834404 /* CCImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCImage.cpp; sourceTree = "<group>"; };
3E26D40718ACB63900834404 /* CCDevice.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCDevice.mm; sourceTree = "<group>"; };
3EA0FB59191B92CC00B170C8 /* UIVideoWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIVideoWidget.h; sourceTree = "<group>"; };
3EA0FB5A191B92CC00B170C8 /* UIVideoWidgetIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIVideoWidgetIOS.mm; sourceTree = "<group>"; };
46A15FCC1807A544005B8026 /* AUTHORS */ = {isa = PBXFileReference; lastKnownFileType = text; name = AUTHORS; path = ../AUTHORS; sourceTree = "<group>"; };
46A15FCE1807A544005B8026 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = text; name = README.md; path = ../README.md; sourceTree = "<group>"; };
46A15FE11807A56F005B8026 /* Export.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Export.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3973,6 +3977,8 @@
2905F9E618CF08D000240AA3 /* ui */ = {
isa = PBXGroup;
children = (
3EA0FB59191B92CC00B170C8 /* UIVideoWidget.h */,
3EA0FB5A191B92CC00B170C8 /* UIVideoWidgetIOS.mm */,
2905F9E918CF08D000240AA3 /* CocosGUI.cpp */,
2905F9EA18CF08D000240AA3 /* CocosGUI.h */,
2905F9EB18CF08D000240AA3 /* GUIDefine.h */,
Expand Down Expand Up @@ -5468,6 +5474,7 @@
1A5701A0180BCB590088DEC7 /* CCFont.h in Headers */,
1A5701A4180BCB590088DEC7 /* CCFontAtlas.h in Headers */,
1A5701A8180BCB590088DEC7 /* CCFontAtlasCache.h in Headers */,
3EA0FB5B191B92CC00B170C8 /* UIVideoWidget.h in Headers */,
500DC98919106300007B91BF /* CCNS.h in Headers */,
1A5701B4180BCB590088DEC7 /* CCFontFNT.h in Headers */,
1A5701B8180BCB5A0088DEC7 /* CCFontFreeType.h in Headers */,
Expand Down Expand Up @@ -6557,6 +6564,7 @@
50FCEB9818C72017004AD434 /* CheckBoxReader.cpp in Sources */,
1A570076180BC5A10088DEC7 /* CCActionGrid3D.cpp in Sources */,
500DC99D19106300007B91BF /* CCValue.cpp in Sources */,
3EA0FB5C191B92CC00B170C8 /* UIVideoWidgetIOS.mm in Sources */,
B37510851823ACA100B3BA6A /* CCPhysicsWorldInfo_chipmunk.cpp in Sources */,
1A57007A180BC5A10088DEC7 /* CCActionInstant.cpp in Sources */,
1A57007E180BC5A10088DEC7 /* CCActionInterval.cpp in Sources */,
Expand Down
22 changes: 22 additions & 0 deletions build/cocos2d_tests.xcodeproj/project.pbxproj
Expand Up @@ -812,6 +812,9 @@
29080DE4191B595E0066F8DF /* UIWidgetAddNodeTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D89191B595E0066F8DF /* UIWidgetAddNodeTest.cpp */; };
29080DE5191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */; };
29080DE6191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */; };
3EA0FB5E191B92F100B170C8 /* cocosvideo.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */; };
3EA0FB64191B931500B170C8 /* UIVideoWidgetTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EA0FB62191B931500B170C8 /* UIVideoWidgetTest.cpp */; };
3EA0FB66191B933000B170C8 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; };
A05FCACA177C124500BE600E /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64822165F391E007D4F18 /* Cocoa.framework */; };
A07A521E1783A1D20073F6A7 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C6482E165F399D007D4F18 /* libz.dylib */; };
A07A521F1783A1D20073F6A7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64832165F3AFD007D4F18 /* Foundation.framework */; };
Expand Down Expand Up @@ -1844,6 +1847,10 @@
29080D8A191B595E0066F8DF /* UIWidgetAddNodeTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidgetAddNodeTest.h; sourceTree = "<group>"; };
29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIWidgetAddNodeTest_Editor.cpp; sourceTree = "<group>"; };
29080D8C191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidgetAddNodeTest_Editor.h; sourceTree = "<group>"; };
3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; name = cocosvideo.mp4; path = "../tests/cpp-tests/Resources/cocosvideo.mp4"; sourceTree = "<group>"; };
3EA0FB62191B931500B170C8 /* UIVideoWidgetTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIVideoWidgetTest.cpp; sourceTree = "<group>"; };
3EA0FB63191B931500B170C8 /* UIVideoWidgetTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIVideoWidgetTest.h; sourceTree = "<group>"; };
3EA0FB65191B933000B170C8 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/MediaPlayer.framework; sourceTree = DEVELOPER_DIR; };
46A15F9C1807A4F8005B8026 /* cocos2d_libs.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = cocos2d_libs.xcodeproj; sourceTree = "<group>"; };
A035A71117822E9E00987F6C /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; };
A07A52291783A1D20073F6A7 /* cpp-tests iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "cpp-tests iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -2011,6 +2018,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3EA0FB66191B933000B170C8 /* MediaPlayer.framework in Frameworks */,
1AAF53FE180E39D4000584C8 /* libbox2d iOS.a in Frameworks */,
1AAF53FF180E39D4000584C8 /* libchipmunk iOS.a in Frameworks */,
1AAF5400180E39D4000584C8 /* libcocos2dx iOS.a in Frameworks */,
Expand Down Expand Up @@ -3256,6 +3264,7 @@
1AC35CA818CED83500F37B72 /* Resources */ = {
isa = PBXGroup;
children = (
3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */,
1AC35CA918CED84500F37B72 /* animations */,
1AC35CAE18CED84500F37B72 /* ccb */,
1A221C9B191771E300FD2BE4 /* ccs-res */,
Expand Down Expand Up @@ -3462,6 +3471,7 @@
29080D1E191B595E0066F8DF /* CocoStudioGUITest */ = {
isa = PBXGroup;
children = (
3EA0FB61191B931500B170C8 /* UIVideoWidgetTest */,
29080D1F191B595E0066F8DF /* CocosGUIScene.cpp */,
29080D20191B595E0066F8DF /* CocosGUIScene.h */,
29080D21191B595E0066F8DF /* CocoStudioGUITest.cpp */,
Expand Down Expand Up @@ -3733,6 +3743,7 @@
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
3EA0FB65191B933000B170C8 /* MediaPlayer.framework */,
1ABCA3AF18CDA06D0087CE3A /* libz.dylib */,
1ABCA3A818CD9F130087CE3A /* AudioToolbox.framework */,
1ABCA3A618CD9F0D0087CE3A /* OpenAL.framework */,
Expand Down Expand Up @@ -3769,6 +3780,15 @@
name = Frameworks;
sourceTree = "<group>";
};
3EA0FB61191B931500B170C8 /* UIVideoWidgetTest */ = {
isa = PBXGroup;
children = (
3EA0FB62191B931500B170C8 /* UIVideoWidgetTest.cpp */,
3EA0FB63191B931500B170C8 /* UIVideoWidgetTest.h */,
);
path = UIVideoWidgetTest;
sourceTree = "<group>";
};
46A15F9D1807A4F8005B8026 /* Products */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -4440,6 +4460,7 @@
1AC35D0518CED84500F37B72 /* Shaders in Resources */,
1AC35CD318CED84500F37B72 /* background.ogg in Resources */,
1AC35CCB18CED84500F37B72 /* animations in Resources */,
3EA0FB5E191B92F100B170C8 /* cocosvideo.mp4 in Resources */,
1AC35C8C18CECF1400F37B72 /* Icon-114.png in Resources */,
1AC35CF118CED84500F37B72 /* hd in Resources */,
1AC35C9318CECF1400F37B72 /* Icon-57.png in Resources */,
Expand Down Expand Up @@ -4774,6 +4795,7 @@
1AC35B4218CECF0C00F37B72 /* QuestionContainerSprite.cpp in Sources */,
1AC35B6218CECF0C00F37B72 /* DrawPrimitivesTest.cpp in Sources */,
29080DDC191B595E0066F8DF /* UITextFieldTest.cpp in Sources */,
3EA0FB64191B931500B170C8 /* UIVideoWidgetTest.cpp in Sources */,
1AC35C1818CECF0C00F37B72 /* MotionStreakTest.cpp in Sources */,
1AC35C0618CECF0C00F37B72 /* FontTest.cpp in Sources */,
1AC35C3818CECF0C00F37B72 /* PerformanceTest.cpp in Sources */,
Expand Down
Expand Up @@ -43,15 +43,16 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
// Constants
// ===========================================================

private static final String TAG = Cocos2dxActivity.class.getSimpleName();
private final static String TAG = Cocos2dxActivity.class.getSimpleName();

// ===========================================================
// Fields
// ===========================================================

private Cocos2dxGLSurfaceView mGLSurfaceView;
private Cocos2dxHandler mHandler;
private static Context sContext = null;
private static Cocos2dxActivity sContext = null;
private Cocos2dxVideoHelper mVideoHelper = null;

public static Context getContext() {
return sContext;
Expand Down Expand Up @@ -80,12 +81,15 @@ protected void onCreate(final Bundle savedInstanceState) {

sContext = this;
this.mHandler = new Cocos2dxHandler(this);


Cocos2dxHelper.init(this);

this.init();

Cocos2dxHelper.init(this);
if (mVideoHelper == null) {
mVideoHelper = new Cocos2dxVideoHelper(this, mFrameLayout);
}
}

// ===========================================================
// Getter & Setter
// ===========================================================
Expand Down Expand Up @@ -142,6 +146,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data)
}


protected FrameLayout mFrameLayout = null;
// ===========================================================
// Methods
// ===========================================================
Expand All @@ -151,8 +156,8 @@ public void init() {
ViewGroup.LayoutParams framelayout_params =
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
FrameLayout framelayout = new FrameLayout(this);
framelayout.setLayoutParams(framelayout_params);
mFrameLayout = new FrameLayout(this);
mFrameLayout.setLayoutParams(framelayout_params);

// Cocos2dxEditText layout
ViewGroup.LayoutParams edittext_layout_params =
Expand All @@ -162,13 +167,13 @@ public void init() {
edittext.setLayoutParams(edittext_layout_params);

// ...add to FrameLayout
framelayout.addView(edittext);
mFrameLayout.addView(edittext);

// Cocos2dxGLSurfaceView
this.mGLSurfaceView = this.onCreateView();

// ...add to FrameLayout
framelayout.addView(this.mGLSurfaceView);
mFrameLayout.addView(this.mGLSurfaceView);

// Switch to supported OpenGL (ARGB888) mode on emulator
if (isAndroidEmulator())
Expand All @@ -178,7 +183,7 @@ public void init() {
this.mGLSurfaceView.setCocos2dxEditText(edittext);

// Set framelayout as the content view
setContentView(framelayout);
setContentView(mFrameLayout);
}

public Cocos2dxGLSurfaceView onCreateView() {
Expand Down