02-23-2012 02:10 PM
Hello, I'm trying to find an alternative method to create a BCPlayerView. Going from the code examples, I see:
player = (BCPlayerView) findViewById(R.id.player);
And also some accompanying xml layout info that needs to be added to main.xml. The trouble is I cannot have such an xml document in this project.
A little background - I'm testing development with the Unity3D game dev engine and the project needs to stream video hosted at Brightcove. I already have video streaming working fine for iOS via plugin development for Unity, and now I'm trying to do the same with Android. I'm pretty new to Android development as well, so that's partly to blame. Unity generates an Eclipse project, but it has no main.xml or other standard Android UI files, as almost everything is hadled by OpenGL, so there is no need. The project folder is generated automatically when you build in Unity, and there's no opportunity to insert additional files into that temp project, much less have them compile into the finished product (Unity also generates the apk).
I've been able to use Unity's plugin technology to extend the Activity which allows me to add the ReadAPI and get at the media, but then when I try to create the BCPlayerView, it chokes as it doesn't have access to R.id.mPlayer, it just simply doesn't exist in this context. Is there some other way to pass it a proper context via code without relying on an external xml file?
Yes it's complicated, but thanks for reading!
03-01-2012 03:58 PM
WHile there may not be a huge audience that needs to develop in Unity and work with Brightcove, I'll post this anyway in case someone down the road is searching for these answers.
Within your Unity project you can include an entire Android Java project (Eclipse-style as I like to think of it). Within your Assets folder, you will have a Plugins folder, and within that an Android folder. Inside the Android folder is where you put the contents of your Android project, at least all the necessary components. In there I've included the 2 Brightcove jar files, a custom jar file containing the Java class file which creates the UnityPlayer and a few other classes that extend off of this class, for more flexibility. There is also the AndroidManifest.xml and key in that file is the specify the acitivty contained in the custom jar. So something like <activity android:name="com.your.app.CustomUnityActivity" android:label="@string/app_name">
The other key bit is to include a res folder. You'll need to include inside that the drawable, layout and values folders. In the drawable, make sure to include at the images and xml bits that are used by bcplayer_controls.xml, and in the layout folder include that xml. In here you must also have the XML layout for the play, something like bcplayer.xml, which contains the xml code as documented in the Getting Started guide on this site.
With all this in place, you should be able to add the necessary Java code for the ReadAPI and BCPlayerView to the CustomUnityActivity class wherever you need it and export the jar file. You can also make use of Unity's AndroidJavaClass and AndroidJavaObject to access the activity at runtime and pass messages to it.
04-30-2013 11:36 AM
do you have any info on the plugin for ios / unity3d ?
Brightcove Inc., a leading global provider of cloud content services, provides a family of products used to publish and distribute the world's professional digital media. The company's products include Brightcove Video Cloud, the market-leading online video platform, and Brightcove App Cloud, the pioneering content app platform. Together, more than 4,200 customers in 50 countries rely on Brightcove's cloud content services to build and operate exceptional media experiences across PCs, smartphones, tablets and connected TVs.
Brightcove Inc.
© 2012 Brightcove Inc.
