Posted by & filed under Android, library.

The following post is from Walter Kuppens, who is doing some great work on our Android projects. Congrats on your first open release of awesome Walter!

Just looking for the code? The repo is now available on Github: immersive-videoplayer-android

One thing that I have yet to see is a video player for android that appropriately mimics the YouTube video player. For that very reason I set off to create my own implementation of a video player like YouTubes and surprisingly it works very well. Well, with the use of a few nasty hacks of course!

ImmersiveVideoPlayer is an android library that contains an activity and a few objects that allow you to stream videos in a video player much like YouTube’s. How it works is that it displays video information passed to the activity in the form of a Video object through an intent. The activity can then display information such as a video title or a description while in portrait mode, but when in landscape mode the video player will enter an “immersive mode” of sorts.

Basically in simple terms is the immersive mode hides all distractions such as the status bar and the soft keys to allow a more “immersive” viewing experience. In addition when the video is tapped the soft keys and status bar will re-appear shortly before fading away. I think this is starting to sound familiar.

But as mentioned earlier the library uses a few nasty hacks to get it working properly. One of the first issues I ran into is that when you tap the screen, the soft keys will magically re-appear but sends no click callback to any of the views you tapped. This became an issue because you would have to tap twice to bring up the video controller which would have been a nuisance.

However I found out that a check can be done on the current UI visibility of the app allowing me to tell if the soft keys are present or not. I then created a thread that runs in the background checking for a change in UI visibility and if the soft keys re-appear, the media controller and status bar will show appropriately. Very hacky indeed.

Although some might frown upon this, it is the only way I could have seen it be done and better yet, it works almost flawlessly. By almost I mean there a a couple issues.

The first issue is that on pre android 4.3 devices the media controller dips below the video player fragment (which is apparently a feature), and can probably be fixed with a custom media controller. The second issue is that the soft keys cannot be hid until their show animation is complete. As a result if the user spam clicks the video, the video controller and soft keys cannot hide until the user clicks after the animation. However I don’t see this as a big issue as a user will most likely not be playing with the media controller as a toy.

Now here is the part you have all been waiting for… Implementation!

Implementation

First you will want to create a new android project with a main activty (assuming you are using eclipse).
File > New > Android Project

Now you need to import the ImmersiveVideoPlayer project into the eclipse workspace.
File > Import > Android > Existing Android Code Into Workspace

Next you want to make some changes to your manifest. First lets add a permission.

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

Add the video player activity.

<activity
android:name="com.stickmanventures.android.example.immersive_videoplayer.ui.activities.VideoPlayerActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize" >
</activity>

Note we have added orientation|screenSize to the config changes so that android does not reload the activity on orientation change.

Now we are ready to implement it to the new project, first lets edit the default activites layout.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >
 
    <Button 
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Load Video Player" />
 
</RelativeLayout>

Now open your activity class and reference the button with:

Button button = (Button) findViewById(R.id.button);

Then add an OnClickListener like so:

	button.setOnClickListener(new OnClickListener() {
		@Override
		public void onClick(View v) {
 
}
});

Before we continue add this above our button reference.

final Activity activity = this;

The reason we are doing this is that “this” in the onClick callback is not that same as “this” outside the onClick callback and we need the current applications context to be passed to an intent.

Now we can add can start the video player activity with a few extras.

Intent intent = null;
 
	try {
	intent = new Intent(activity,
Class.forName("com.stickmanventures.android.example.immersive_videoplayer.ui.activities.VideoPlayerActivity"));
	} catch (ClassNotFoundException e) {
		e.printStackTrace();
	} finally {		
		// Create a video object to be passed to the activity
		Video video = new Video("http://clips.vorwaerts-gmbh.de/VfE_html5.mp4");
		video.setTitle("Big Buck Bunny");
		video.setAuthor("the Blender Institute");
		video.setDescription("A short computer animated film by the Blender Institute, part of the Blender Foundation. Like the foundation's previous film Elephants Dream, the film was made using Blender, a free software application for animation made by the same foundation. It was released as an Open Source film under Creative Commons License Attribution 3.0.");
 
		// Launch the activity with some extras
		intent.putExtra(ImmersiveVideoplayer.EXTRA_LAYOUT, "1");
		intent.putExtra(Video.class.getName(), video);
		startActivity(intent);
	}

So first we create a new intent to load the video player activity which we will start later after doing a couple of steps.

	intent = new Intent(activity, Class.forName("com.stickmanventures.android.example.immersive_videoplayer.ui.activities.VideoPlayerActivity"));

Next we create a video object with information like the url, a description, author, and title.

	// Create a video object to be passed to the activity
	Video video = new Video("http://clips.vorwaerts-gmbh.de/VfE_html5.mp4");
	video.setTitle("Big Buck Bunny");

Then we pass the video object and what type of layout we want as extras (0 is the simple video player, and 1 is the advanced video player).

	// Launch the activity with some extras
	intent.putExtra(ImmersiveVideoplayer.EXTRA_LAYOUT, "1");
	intent.putExtra(Video.class.getName(), video);

After that is said and done, it is safe to call the activity.

startActivity(intent);

After that it should work, but if it doesn’t make sure to clean both the library project and the current project incase there are any conflicting IDs and you should get something that looks like this.

device-2013-10-21-155208

It is as simple as that, and since this is a library you can make changes to the source code or layout of the video player to your pleasure.

Posted by & filed under Google Glass.

Our own Justin Ribeiro, sporting Google Glass these days, was written up recently for his work with developing Glassware applications over at Living Thru Glass, “Six Glass Apps you haven’t heard of that will get tech nerds excited.“.

Justin’s been busy writing a lot of applications for Glass, everything from farming based applications (see Glass screenshot below) to Glassware submission tooling.

20130909_181216_361_x (1)

He also showed off controlling an Arduino with Glass via a MQTT broker bridge he designed for the Mirror API:

Posted by & filed under animation.

On Friday of last week, we helped push out a new animated series, Dig Build Live.

The new animated series will feature the styling of David, Steven, and Jordan as they take you into a different sort of Minecraft world, featuring new characters and creatures not found in the game.

You can find the series on YouTube or directly on DigBuildLive.com. You can talk to the team socially on Google+, Twitter.

screenshot of digbuildlive.com

Posted by & filed under 3D Printing, EclipseCon.

Justin’s talk proposal, “Merging technologies to bring 3D printing status to the web” has been accepted for EclipseCon 2013 in Boston!

He’s been working on bringing MQTT support into ReplicatorG via Eclipse Paho. Beyond that, the overall goal is to bring those updates onto the web Internet-of-things style. If you don’t want to click through to the talk session page, Justin will be covering:

  • Integrating Eclipse Paho into ReplicatorG to handle M2M messaging with MQTT
  • Integrating GSON into ReplicatorG
  • Building ReplicatorG with Eclipse
  • Building a web socket server using pywebsocket
  • Building a response site that using HTML5 web socket API

We hope you make it out!

EclipseCon 2013

Posted by & filed under animation.

If you happened to watch the Video Game Awards on Spike TV on December 7th, you might have noticed a Minecraft clip that aired that put the host of the program, Sam Jackson, in the game.

One would often assume that segment was produced by Mojang, but rather that was the animation stylings of David Steele and Jordan Maron. We were originally contacted by the producers of the program a few months before the air date, as they had viewed some of David’s previous Minecraft related animations.

We able to get said clip completed with time to spare. If you recognized the voice of happy guy, who gets taken down by Sam, that was Jordan.

We want to say thank you to Geoff Keighley and the producers at the VGA’s for giving us a ring. We had a blast being able to produce it.

Render still from VGA's

Posted by & filed under animation, video.

A big congratulations to Jordan, David and company for finishing and releasing “Minecraft Style” – A Parody of PSY’s Gangnam Style (Music Video). The music video parody has nearly 10 million views at the time of this writing and continues to climb.

It cannot be stated the amount of work that was put in to this video. We watched over the course of three weeks at the office as it came together, culminating in a video that is nearly a shot by shot recreation of the original (including little details such as certain flipped reflections). All the assets were created from scratch in Maya, from sets to the character rigging.

For a behind-the-scene the look:

Posted by & filed under 3D Printing, Makerbot.

We recently brought in a Makerbot Dual Replicator into the office. The primary reason was for faster product prototyping and it’s been an absolute joy to work with.

Besides working from a product perspective, we’ve also dived into the guts of the software. Justin has been actively build a web status panel that utilizes Eclipse Paho, MQTT, python and the ever present HTML5 websocket. He goes into a bit of the details on his blog.

What to see what our Makerbot is printing? You can always check the stats on our Stickman Makerbot Status page, powered by Justin’s open source code.

David leveling the build plate

Posted by & filed under Arduino, HTML5, MQTT, PHP.

One of the team, Justin, has been working on a number of Internet of things source code lately. He recently published a demo entitled “The internet of things: trigger an LED on an Arduino with MQTT, Mosquitto, Ratchet, and HTML5 WebSocket API” which delves into the basics of getting started using the popular Arduino platform as well as a number of open source tools.

Worth a look if you’re interested in connecting your toaster to the Internet!