Android – Bitmovin https://bitmovin.com Bitmovin provides adaptive streaming infrastructure for video publishers and integrators. Fastest cloud encoding and HTML5 Player. Play Video Anywhere. Wed, 11 Oct 2023 21:29:36 +0000 en-GB hourly 1 https://bitmovin.com/wp-content/uploads/2023/11/bitmovin_favicon.svg Android – Bitmovin https://bitmovin.com 32 32 Creating a Live Streaming Setup with Android Devices and Bitmovin https://bitmovin.com/blog/creating-live-stream-android-bitmovin/ Tue, 20 Dec 2022 11:27:55 +0000 https://bitmovin.com/?p=247692 It is that time of the quarter again at Bitmovin, Hackathon time. Our Hackathon includes two days of hacking solutions together before presenting the results to the wider business. Every programmer loves it and even more when your team is winning.  During this Hackathon, we decided to step out of our backend-comfort zone and tinker...

The post Creating a Live Streaming Setup with Android Devices and Bitmovin appeared first on Bitmovin.

]]>
It is that time of the quarter again at Bitmovin, Hackathon time. Our Hackathon includes two days of hacking solutions together before presenting the results to the wider business. Every programmer loves it and even more when your team is winning.  During this Hackathon, we decided to step out of our backend-comfort zone and tinker a bit with UI.

To be more specific, we tried to write an android app that would serve as an RTMP input source for a live stream.

Setting up an RTMP input can be lengthy, especially when there is no computer with FFmpeg at hand. And syndetic input can be boring at times. So why not use a live feed from your mobile device for this? My go-to tool to create an RTMP stream is FFmpeg so let’s try to use this in android. We quickly realized that that was a futile endeavor, especially in two days. So we did what any software developer would do and looked for a library that had been written by somebody smarter than us. We tried a few libraries like the Larix Broadcaster SDK or some small GitHub repositories like the LiveVideoBroadcaster but weren’t able to get any of these to work in the limited time we had. Finally, a bit more searching revealed the grail we had been looking for; we unearthed this library and managed to get something running.

How to use it

The library creates a very handy OpenGLView that lets you show the camera in your activity. If you’d like to follow along with the steps we took, then to start, simply add it to your XML config like this:

<com.pedro.rtplibrary.view.OpenGlView
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    android:id="@+id/surfaceView"
    app:keepAspectRatio="true"
    app:aspectRatioMode="fill"
    app:AAEnabled="false"
    app:numFilters="2"
    app:isFlipHorizontal="false"
    app:isFlipVertical="false"
    />

The corresponding code will need an OpenGlView object as well as a RtmpCamera object. Let’s go ahead and create those:

private RtmpCamera2 rtmpCamera;
private OpenGlView openGlView;

Those elements also need some values assigned, and we used the onCreate method for that:

this.openGlView = findViewById(R.id.surfaceView);
this.rtmpCamera = new RtmpCamera2(openGlView, this);
this.openGlView.getHolder().addCallback(this);

Starting an RTMP stream

As all of the necessary configurations were complete, we just have to start the RTMP stream. To do that, the only thing we need to add to the code below (how to obtain that will be shown later).

@Override
public void startStreaming() {
   runOnUiThread(() -> {
       if (!rtmpCamera.isStreaming()) {
           if (rtmpCamera.isRecording()
                   || rtmpCamera.prepareAudio() &&                      rtmpCamera.prepareVideo()) {
               rtmpCamera.startStream("URL to you live stream");
               setStateStreamIsRunning();
           } else {
               this.toastError( "Error preparing stream, This device cant do it");
           }
       } else {
           rtmpCamera.stopStream();
       }
   });
}

We used a separate thread and a callback for that. That is why there is a runOnUiThread, but if you start the RTMP stream from your activity, you will not need that.

The RTMP URL can be set here rtmpCamera.startStream("URL to you live stream");

Setting up the live stream encoder

For our encoder, we used the simple API https://bitmovin.com/docs/encoding/articles/simple-encoding-api-live, so we needed minimal configuration to get the live stream up and running. We used the CDN https://bitmovin.com/docs/encoding/articles/bitmovin-cdn-output output as well because it would work out of the box.

To get this going, the first thing to set up is the input:

private SimpleEncodingLiveJobResponse setUpLiveStream() {
   SimpleEncodingLiveJobInput input = new SimpleEncodingLiveJobInput();
   input.setInputType(SimpleEncodingLiveJobInputType.RTMP);
   SimpleEncodingLiveJobRequest job = new SimpleEncodingLiveJobRequest();
   SimpleEncodingLiveJobCdnOutput outputUrl = givenCdnOutputWithFullHDResolution();

Next is the output. In the spirit of the hackathon, we used a CND because of the minimal configuration, which you can set up like this:

private SimpleEncodingLiveJobCdnOutput givenCdnOutputWithFullHDResolution() {
   SimpleEncodingLiveJobCdnOutput output = new SimpleEncodingLiveJobCdnOutput();
   output.setMaxResolution(SimpleEncodingLiveMaxResolution.FULL_HD);
   return output;
}

Now only some minor configurations are left.

   job.setInput(input);
   job.addOutputsItem(outputUrl);
   job.setCloudRegion(SimpleEncodingLiveCloudRegion.EUROPE);
   job.setName("Android app live stream");
   return bitmovinApi.encoding.simple.jobs.live.create(job);
}

Finishing touches

A live stream takes a bit of time to be ready. in the essence of time, we swiftly did a very ugly “busy waiting” loop to wait until the live stream was done with the setup. To improve this, we have left it as an exercise for the reader.

public boolean setupLiveStreamAndWaitForRunningState(Callback cb) {
   this.stopped = false;
   this.encodingId = null;
   SimpleEncodingLiveJobResponse jobResponse = setUpLiveStream();
   try {
       while (!readyForIngestOrFailed(jobResponse) && !stopped) {

           Thread.sleep(300);
           jobResponse = bitmovinApi.encoding.simple.jobs.live.get(jobResponse.getId());
           if (jobResponse.getEncodingId() != null && this.encodingId == null) {
               this.encodingId = jobResponse.getEncodingId();
           }
           cb.reportStatus(jobResponse.getStatus().toString());
       }
   } catch (Exception e) {
       cb.toastError(e.getMessage());
   }
   if (this.stopped || this.encodingId == null || this.encodingId.isEmpty())
   {
       return false;
   }
   cb.startStreaming();
   this.rtmpUrl = String.format("rtmp://%s/live/%s", jobResponse.getEncoderIp(), jobResponse.getStreamKey());
   return true;
}

To retrieve the RTMP URL that needs to be inserted into the code, get it by using:

this.rtmpUrl = 
String.format("rtmp://%s/live/%s", jobResponse.getEncoderIp(), 
jobResponse.getStreamKey());

We had to run this in a separate thread because you cannot have HTTP requests in the UI thread in android, and it would not be a good user experience anyway.

Once the hard part was done, we spent the second day of the hackathon refining the app and making the UI better and even got some much-appreciated help from one of the Bitmovin UX designers.

Wrapping up

As the hackathon drew to a close, the competition was fierce, with great projects submitted by other teams. However, in the end, all of the efforts paid off, as our team won first place! 

Here are a couple of images of how the live stream worked on an Android phone:

- Bitmovin

Visual of stream interface pre-live

- Bitmovin

Visual of active live stream

Additionally, if this project was interesting to you and you’re currently looking to test your streaming application across Android, iOS, or any other platform/device, check out our 30-day free trial where you can test the Bitmovin Live and VOD Encoder, Player or any of our other SaaS solutions completely free with no commitment.

The post Creating a Live Streaming Setup with Android Devices and Bitmovin appeared first on Bitmovin.

]]>
Control and Customize Offline Playback for Mobile SDKs https://bitmovin.com/blog/offline-playback-mobile-sdks/ Wed, 13 Mar 2019 23:32:03 +0000 https://bitmovin.com/?p=28932 We are noticing that more and more services are following Neflix’s lead in terms of implementing download and offline playback within their mobile applications. This is a feature that Bitmovin has supported for a while now. We have also added many more features to our Android and iOS SDKs as we worked with our customers to...

The post Control and Customize Offline Playback for Mobile SDKs appeared first on Bitmovin.

]]>
Mobile Offline Playback
We are noticing that more and more services are following Neflix’s lead in terms of implementing download and offline playback within their mobile applications. This is a feature that Bitmovin has supported for a while now. We have also added many more features to our Android and iOS SDKs as we worked with our customers to implement download and offline playback for their mobile applications.

Supported Platforms:
iOS SDKs (iOS 9+)
Android SDKs (Android 4.4+)


The Bitmovin Advantage with Offline Playback

Bitmovin Mobile SDKs provides a class called OfflineManager that encapsulates all content download operations like starting content downloads, pausing and resuming downloads, canceling downloads and deleting already downloaded content.
The OfflineManager seamlessly maintains and returns the correct download states regardless of whether the application is in foreground mode, background mode or application gets force closed by user or crashes unexpectedly.
Here are the top reasons why Bitmovin can provide the best experience if you’re considering implementing download or offline playback for your mobile application(s):

  • Quick to implement: Developers can follow our tutorials or jumpstart POCs through our readily available Github projects.
  • Easy to Use: Our Mobile Player SDKs and Player APIs simplifies and abstracts the download workflow so developers can implement their custom business rules and focus on end user experience.
  • Simplified DRM implementation: Our Mobile Player SDKs supports download and offline playback of DRM and non-DRM content. We support easy-to-use offline DRM APIs that works with both Apple and Android devices. Benefits include:
    • Easy configurations to decorate or modify DRM requests as needed for offline and custom content workflows
    • Flexible DRM APIs that work with any major DRM provider (Ex: Irdeto, Verimatrix, BuyDRM and more)
  • Enables Customizations: Download Manager and APIs can be easily extended to support custom download use cases like:
    • Implementing custom DRM, License requests
    • Storing and Managing content on External storage
    • Customizing Device Notifications for better user experience
    • Customizing Content License rules (Ex: Enable background license refresh every 2 weeks etc)
  • Road Tested: Bitmovin delivers a very advanced and feature-packed Download Module that’s been production tested across major Broadcaster and Media customer deployments. We have evolved the feature set over the past year and addressed edge cases through first-hand experience.
  • Excellent Support: Unlike Open Source Players (OSP), we provide APIs for all the major Download use cases that’s easier and more convenient to use. We also enable customizations to support unique workflows. We also provide expert staff to support implementation needs and answer questions through the integration process.

Control the Offline Playback Download Lifecycle:

The Bitmovin Download feature is supported for both clear and DRM protected content. Bitmovin provides Player APIs and Events to track the download lifecycle:

  • Start Download
  • Suspend Download
  • Resume Suspended Download
  • Cancel Download
  • Delete Download
  • Track Download States
    • Downloaded
    • Downloading
    • Download Completed
  • Download Progress
  • Select one or more Audio, Caption files for Download
  • Select Video Quality for Download
  • Select preview thumbnails for download
  • Handle Download License states
    • Renewal
    • Refresh
    • Expiration

Customize Download Experience Based on your Business Rules:

Bitmovin also provides a few utility features to help developers customize the download behavior and experience depending on device capabilities:

  • Check Device Storage
  • Check External Storage
  • Check Internet Connectivity to determine offline or online playback
  • Provide Device Notifications for download events
  • Enables parallel downloads for multiple downloads
  • Configuration for background downloads
  • Extensive Download Error Reporting

Documentation

Ready to get started? Check out our Bitmovin Player Tutorials for getting started with Download on Mobile SDKs. We also provide code samples in our Github repos to help jumpstart development and POCs.

Tutorials:

Github Code Samples:

The post Control and Customize Offline Playback for Mobile SDKs appeared first on Bitmovin.

]]>
A Beginner’s Guide to Bitmovin’s Android SDK on Android TV Platforms https://bitmovin.com/blog/beginners-guide-bitmovins-android-sdk-android-tv-platforms/ Thu, 10 Jan 2019 05:09:21 +0000 https://bitmovin.com/?p=24961 The post A Beginner’s Guide to Bitmovin’s Android SDK on Android TV Platforms appeared first on Bitmovin.

]]>

I’m Michael Riha, a Solutions Architect with Bitmovin. I wrote this guide to make it easy and save you time implementing Android TV apps using the Bitmovin Player SDK.

A couple of months ago I had to build a prototype to showcase our capabilities on an old Android TV device with a rather old version of the Android operating system, v6 Marshmallow.
I hadn’t done any Android development since 2011, so I used this as an opportunity to write this guide to help anyone with even basic Android development experience get started. This took me a few hours to implement on my own, so hopefully my guide below combined with our code samples can get you started much faster! (And if you’ve made an existing Android app for video playback it will probably be even easier, after all Google claims that you can “bring your Android app to Android TV in minutes!”)

What are we building?

- Bitmovin


We’re making a simple Android TV proof of concept app. You’ll need some source video assets, basic experience using Android Studio installed on your preferred development machine, and an active or trial license of the Bitmovin player to complete the full guide.

Why Android TV?

We’ve seen a recent trend of TV manufacturers and operators like Sony, Mi-Box and AT&T adopting Android as their base operating system for Smart TVs and set top boxes. Features such as access to the Google Play Store and rich video playback capabilities with 4K and HDR have helped Android dominate the global Smart TV operating system, with market share over 40% per a recent report from IHS.
Unlike other popular Smart TV OS providers, Google has greatly simplified development for TVs by simply extending their existing mobile operating system for television sets and adapting the user interface for a remote input thereby consolidating towards a single development platform that can target various mobile and television screens regardless of touch or remote inputs.
Given the broad reach of the platform and the relative ease of development, this presents a perfect opportunity for developers and content owners to quickly re-purpose their Android Mobile player SDKs and apps for Android TV development, allowing them to reach more target devices and acquire audiences across new screens with little to no additional effort.

Bitmovin Support for Android and Android TV

Bitmovin has provided an Android Player SDK for a few years now. Since its debut in 2017 with basic MPEG-DASH and HLS playback capabilities, we have come a long way to add more premium out-of-the-box features like advertising, analytics integrations, DRM support, Chromecast support, VR playback, `CustomUI` and much more to stay ahead of modern streaming needs.
More importantly, we are obsessed with performance and know how important it is for our customers and end users to have a really good playback experience. For this reason, we provide advanced video playback optimization features such as fully customizable ABR logic, multi-codec streaming, offline playback and much more all included in the robust player SDKs and unified Player APIs so developers can quickly and easily deploy media apps for any and all Android OS supported platforms.
Our full list of sample code and quick start guides can be found here:
https://github.com/bitmovin/bitmovin-player-android-samples
Unlike many of our competitors, we support a complete native player implementation and do not use an HTML5 player with a WebView for video playback in our Android SDKs. However, we do support common JavaScript APIs for skin customizations and third party integrations to simplify development, optimize playback performance and leverage other benefits of the hardware media decoding capabilities through what we call a “hybrid approach” as detailed in our post on HTML5 vs. hybrid vs. native Apps.

Getting Started with Android TV

It has been a few years since I developed an Android TV application, so it was time for a refresher of the Android TV basics. I think these notes would have saved me a lot of time getting started, so I had to share! (Skip this section if you’re already familiar with Android TV and just want the quick player SDK implementation guide.)
If you are building an app that operates both on TV and other devices, you will need to first check what kind of device your app is running on and accordingly adjust the operation of your app.
The recommended way to determine if your app is running on a TV device is to use the UiModeManager.getCurrentModeType() method to check if the device is running in television mode.

https://developer.android.com/training/tv/start/hardware
Probably the hardest part about the video player for someone coming from a web or mobile background is handling user interactions via various controllers (remote or console) depending on what hardware the TV or set top box vendor may offer as there is no touchscreen like phones for Android TVs, at least for now.
Not to worry, Bitmovin already offers default user interfaces for phones, TVs and Chromecast which can be used as-is or easily modified to support a full range of customizations. The native Bitmovin Android Player SDK itself uses a WebView on top of the video player to offer maximum compatibility and convenience for developers to reuse CSS and JavaScript based interfaces with few quick tweaks.
This means we can use one interface to rule all the devices!
The Bitmovin Adaptive Streaming Player UI is open source and can be found here. https://github.com/bitmovin/bitmovin-player-ui

Meet the D-Pad

- Bitmovin
Animated gif of D-pad input in Android Studio emulator


While the graphical user interface is easy to show and use remember we do not have a touchscreen! Instead we have another input called the directional pad, or D-pad.
The primary navigation method on Android TV is the D-pad, offering basic movement up, down, left, and right via directional hardware buttons. Next to the navigation buttons most remotes also have Select, Back and Home buttons.
In addition to the D-pad, the end user can also plug in gamepads or even standard keyboards to the device via USB, but I wanted to make my life easy at the beginning so I just supported D-pad inputs.

For my sample project we did end up supporting keyboards at a later stage, but let’s leave that for another day.

Add a TV Activity

Android system initiates code in an Activity instance by invoking specific callback methods that correspond to specific stages of its lifecycle. Most basic interactions with the player i.e. Play, Pause and Seeking can be implemented directly in an Activity.
If you already have an Android app, you can add Android TV support quickly by reusing your existing app architecture. For this purpose, there are two main components you should use to create an app that runs on TV devices:

  • Activity for TV (Required) – In your application manifest, declare an activity that is intended to run on TV devices.
  • TV Support Libraries (Optional) – There are several support libraries available for TV devices that provide widgets for building user interfaces.

https://developer.android.com/training/tv/start/start
The official documentation shows how two activities can run side by side and in this example, the TvActivity is the entry point for your AndroidTV app.

Let’s Start Using the Player SDK

If you are already familiar with the Android native player, the Bitmovin Android Player SDK works out of the box in just a few minutes.
If this your first time implementing video playback on Android, we have you covered! Take a look at BasicPlayback-Example or BasicPlaybackTV-Example from the Bitmovin Android Player SDK sample repository. Simply clone and select the appropriate example from here:
https://github.com/bitmovin/bitmovin-player-android-samples/tree/master/BasicPlaybackTV
You’ll need to add your Bitmovin Player license key inside the application tag in the manifest file as shown below. YOUR_LICENSE_KEY has to be replaced by your own license key, obtained through a paid or free trial account.
<meta-data android:name=”BITMOVIN_PLAYER_LICENSE_KEY” android:value=”YOUR_LICENSE_KEY” />
Next, log in to https://dashboard.bitmovin.com and add the following package names of the sample applications as allowed domains under Player -> Licenses.
Optionally, if you want to just start from scratch without any blueprint, follow these eight simple steps from our repository on how to use the Bitmovin Android Player SDK:
https://github.com/bitmovin/bitmovin-player-android-samples#using-the-bitmovin-player-android-sdk

How To: Android Layout & User Interface

Now that we have our Android TV application running in minutes, let’s dig into some details, tips and tricks that I can tell you from playing around with the Bitmovin Android Player SDK player.

Show me the player

First, let’s get the player up and running. There are some ways to get our Player displayed on an app similar to the basic building block for user interface components called a View.

  1. You can add your View to the Layout XML file as we do in our Sample Demo https://github.com/bitmovin/bitmovin-player-android-samples/blob/master/BasicPlaybackTV/src/main/res/layout/activity_main.xml#L2.
  2. It is also possible to instantiate the View in your Activity, however, due to Android TV hardware limitations and legacy OS pitfalls, we recommend to add all views using the Layout XML file when possible.I noticed that it instantiating the View from your main Activity is not as stable on hardware with slower CPUs. So even if it is possible, I wouldn’t recommend it as it took me hours to debug it.
  3. Another option is to use a Fragment, especially if you started building layouts and user interfaces referencing Google’s Android TV examples like browsing content on TV or showing details of a movie with the DetailFragment.Fragments are a modular section of an Activity, which has its own lifecycle, receives its own input events, and which you can add or remove while the activity is running. You can think of it as a “subactivity” that you can reuse. The Bitmovin Android Player SDK also offers the Player as a Fragment and we do also have an example for that. https://github.com/bitmovin/bitmovin-player-android-samples/tree/2d992c76623ae7cd4546c115a3e88597f5fc4f5d/BasicPlayerFragment
Android Studio showing a main activity XML layout

To be honest, I had not used fragments before and started with #2 which cost me hours for some painful debugging. So, after learning about Android TV hardware limitations and legacy OS pitfalls, I highly recommend that you stick to #1 and you will first hand, experience the full power of the Bitmovin Android Player SDK player in every case.

Can’t touch this! Show the UI

As I mentioned earlier, the UI might be tricky if you leave it to the default settings because it is optimized for touch screen devices and uses CSS and JavaScript with a WebView to reuse your custom interface.
I say “might” because in the end, this makes it quite easy and just takes seconds to use an interface that is suited for the TV use-case including our Chromecast player.
It takes just one line to include a local JavaScript file as the UI component on top of the Bitmovin Android Player SDK. This UI is optimized for being used on TV devices, where no touch screen is available.
playerConfiguration.getStyleConfiguration().setPlayerUiJs(“file:///android_asset/bitmovinplayer-ui.js”);
See this snippet directly in our demo code
The JavaScript file for this UI you can find in our Repository here.
You can also create your own user interface from scratch like on our web player. Just take a look at this repository on Github and play around a bit with the web player to debug and if you are satisfied, put it in your Android TV application as shown above. As simple as that!
https://github.com/bitmovin/bitmovin-player-ui

User Interaction and Controls

This part needs some work as we cannot leverage the default GUI as TVs are not touch screen.
We can do a lot of customizations here i.e. build fancy new user interactions based on the D-pad controller, gamepads or even keyboards depending on what might get attached to the Android TV hardware.
But let’s keep it simple to start with.
In our BasicPlaybackTV sample, we listened to all dispatched events occurring when a key press starts inside the Activity.

See this snippet directly in our demo code
Now we just have to handle events that push a key down. This can be used for any button pushed down on a keyboard, D-Pad or gamepad. In the handleUserInput method, we pass the code of the key pushed.

See this snippet directly in our demo code
In the handleUserInput method inside the Activity we map the key-events to the related player API methods. For instance, if the D-pad center button is pressed, we want to toggle between play and pause.

See this snippet directly in our demo code

ABR or better Adaptive bitrate streaming

As I mentioned before, we are obsessed with playback performance. So, we’ve taken extra care when it comes to adaptive streaming. ABR works out of the box with full support for MPEG-DASH & HLS streaming. Additionally, you can also customize or override the default ABR logic through startupBitrate, maxSelectableVideoBitrate, allowRebuffering, videoAdaptation callbacks to override bitrate selection decisions dynamically.
Example: By default, ABR logic is optimized for mobile devices and tries to start up with a lower bitrate for the first few segments but with one line of code(shown below), it can be easily tweaked to suit your TV streaming use-cases where you can choose medium to high starting bitrate.
PlayerConfiguration#setStartupBitrate()

This Snippet can be pasted around this lines in the Code.

Benchmark Using Bitmovin Analytics

In addition to cross platform player SDKs and cloud encoding, Bitmovin also offers an Analytics product which can be used to monitor quality of playback in real time. Developers can also adjust player ABR logic for start up and peak limiting by monitoring actual bitrates consumed by end users to provide the best playback experience while balancing streaming costs.
By using this completely customizable solution, your team can not only set up an analytics interface that fits your business, but they can adapt it as your business develops.
Enabling Analytics in the Bitmovin Android Player SDK is quite easy – even I could do it! 🙂
After including the Lib and getting the license from our dashboard, you include a couple of classes to your android project as described here in our Bitmovin Analytics Collector repository.

Tip: Inside the bitmovinAnalyticsConfig Object, you need the Player license key, which is already stored in the manifest.xml. I was too lazy to paste it another time and thought it could save the trouble for others too.
Here’s a little method that automatically copies the license into the config object for you:

(So during configuration of the Bitmovin Analytics, I just call getPlayerLicenseKey() and put the result into the BitmovinAnalyticsConfig constructor)
If you already have this set up, just attach the bitmovinPlayer to the Analytics Collector and you are good to go.

Ad Integration

Displaying ads using the Bitmovin Android Player SDK is straightforward as well, and we even offer a sample application for this.
To keep it short:

  • You just have to create an AdSource object.
  • This AdSource is used in the constructor of an AdItem.
  • This AdvertisingConfiguration goes straight into the general PlayerConfig to set up the player, as you might already expect if you are familiar with the players from Bitmovin.


If you call play() in the bitmovinPlayer now, all the ads from the AdvertisingConfiguration will be scheduled automatically as well.
See this in action in our full example

Debugging, Benchmarking, and Logging

For debugging purposes, wireless debugging might be a lot of help with Android TV devices. This is pretty straightforward and the Android Developer page explains this in good detail. For convenience, we’ve included the relevant excerpt below:

  1. Connect your Android device and adb host computer to a common Wi-Fi network accessible to both. (use an access point whose firewall is configured properly to support adb)
  2. Connect the device to the host computer with a USB cable.
  3. Set the Android TV device to listen for a TCP/IP connection on port 5555.
    $ adb tcpip 5555
  4. Disconnect the USB cable from the Android TV device
  5. Find the IP address of the Android device, for example: Settings > Wi-Fi Settings > Advanced > IP address.
  6. Connect to the device by its IP address.
    $ adb connect device_ip_address
  7. Confirm that your host computer is connected to the Android TV device
    $ adb devices
    List of devices attached
    device_ip_address:5555 device
  8. Start debugging!
Android Studio showing emulator of Android TV app with network and CPU profiler

Logging is straightforward in Android Studio so nothing new to share there, just take a look at: https://developer.android.com/studio/debug/am-logcat
If you want to listen to errors dispatched by the player, just take a look at these few lines of code. https://github.com/bitmovin/bitmovin-player-android-samples/blob/master/BasicPlaybackTV/src/main/java/com/bitmovin/samples/tv/playback/basic/MainActivity.java#L203
During development, if you want to see what our ABR or Ad Integration is doing, use the built-in Network Profiler in Android Studio. https://developer.android.com/studio/profile/network-profiler

Here you can see how our bitrate adaptation is doing a very good job.

Conclusion

In the end, my final pet project took a couple of hours to set up, but in the process we’ve ironed all those out for you! Hopefully with this article and the new code samples in our repository you can get your Android TV development started in just a few minutes! Code away!
Michael Riha is a product developer for the media content and advertising industry for two decades now. The curiosity he has to look deeply under the hood of digital development in general led to his rare ability to design, and technically implement, digital products with deep technical and strategical knowledge of the market.
The complete package made him the perfect match for Bitmovin as a Senior Solutions Architect.
Do you want to help us make sweet getting started guides like these? We’re hiring!

The post A Beginner’s Guide to Bitmovin’s Android SDK on Android TV Platforms appeared first on Bitmovin.

]]>
Bring your Android app to Android TV in minutes - Google I/O 2016 nonadult
Test Your Streams in Our Player on iOS and Android with the Bitmovin Mobile Apps https://bitmovin.com/blog/test-streams-player-ios-android-bitmovin-mobile-apps/ Fri, 24 Aug 2018 11:20:47 +0000 http://bitmovin.com/?p=24116 Quickly and easily check your video streams in our Native SDKs with the Bitmovin mobile apps using your own streams, DRM licenses and Ad servers If you are considering using the Bitmovin Player in your native app then the first thing you should do is download the Android and/or the iOS Bitmovin app to get...

The post Test Your Streams in Our Player on iOS and Android with the Bitmovin Mobile Apps appeared first on Bitmovin.

]]>
- Bitmovin

Quickly and easily check your video streams in our Native SDKs with the Bitmovin mobile apps using your own streams, DRM licenses and Ad servers

If you are considering using the Bitmovin Player in your native app then the first thing you should do is download the Android and/or the iOS Bitmovin app to get a feeling for what you can expect from the Bitmovin Player when you integrate it into your own app. Our freshly redesigned apps are built specifically to help you to quickly and easily assess and test the Bitmovin Player before you invest time into integration.
Answer questions like: Will your streams play in the Bitmovin Player on Android and iOS? How does DRM work? What are the advertising capabilities and how are they configured? Can you style the UI to fit your brand? All of these questions can be answered in a few minutes using your own streams, DRM licenses and ad sources so you can be sure that the Bitmovin Player is the right player to integrate into your project.

Download the App now:

 

- Bitmovin      - Bitmovin

and follow along on our brief product tour.

 

- Bitmovin

Product Tour: How to Test Video in your Mobile App with Bitmovin SDKs

When you enter the app, one of the easiest ways to get started is to test your video stream in the Bitmovin Mobile Player, seeing if our mobile SDKs will support your stream. Hit “Own Stream” and copy and paste your file URL in the Stream Section at the top. After you hit “Play” you’ll see your video instantly play in the Bitmovin Player.
You can also check your stream for your web version here: Stream Test for DASH, HLS and Progressive

- Bitmovin

UI Styling

A unified user interface ensures that your player will look the same across devices while maintaining brand standards. When you try our streaming video demos, you’ll see a customization option on the “Video Details” screen labeled, “Theme.” Select this option on the bottom left, and you’ll be able to apply a skin that changes the color of the user interface. An added benefit? This styling is enabled via CSS, meaning your developers won’t or devote additional time to custom projects.
Please note, our app is an easily customizable with fully maintained code that you can build your mobile video experience on, but if you’d like to vary the look, feel, and functionality of your mobile app, we do offer sample open-source code. Developers can completely customize apps using our open source video projects.

- Bitmovin

DRM Stream Test

Back in the streaming test area, labeled “Own Stream” there are other options for you to try. Security is paramount to many of our customers, so we’ve made it easy to test an encrypted DRM stream live. Simply copy and paste your license or certificate URL to see if your DRM system and codecs are supported. Integrating DRM into your mobile video app workflow is much easier than you think, and you’re always protected. (Download our DRM Whitepaper or watch our Webinar: DRM Basics with Irdeto & Bitmovin)

- Bitmovin

Ad Scheduling

Also within the area of the app labeled “Own Stream” is our mobile ad scheduling demo. Test our seamless ad insertion and see how our app easily integrates with different advertising standards (VAST, VPAID, IMA, and VMAP). At the bottom of your screen, hit the “+” next to “Schedule Ad” and you’ll be able to set the position and location of your video advertisement. Then, paste the URL and then hit “Play” to see your ad inserted into our standard demo video at the time and location you requested. Push the test to the limits and schedule up to three ads at any time.

- Bitmovin

Chromecast and iOS Airplay

On the “Video Details” screen where you previously analyzed the essential properties of your files and played around with different themes, there is another Bitmovin application to try out! More users are discovering and watching videos on their phones, but sometimes going fullscreen isn’t enough- they want to share these experiences with those around them. This is where video casting and mirroring services like Chromecast and Airplay come in handy. When testing our mobile video app, throw your video stream up on a connected TV in your workplace by simply hitting the “Cast” or “Airplay” button. After confirming the TV name and network, your content will play on a larger screen with quality and resolution intact.

Which Video App Demos Should You Try First?

Testing functionality is a vital part of the development process. But when figuring out how to add video capabilities, you’ll want to “try before you buy” so that you and your team see results before investing. If you’re in Marketing, make sure to try our UI styling demo. If you’re in Media, the Ad Scheduler and AirPlay functionalities may be attractive. Don’t be shy, get in there and play around! Make it a collaborative group activity at your next stand-up. We’ll be here to answer any questions you may have along the way.
Remember, mobile app development can already be a costly undertaking. And now, to stay competitive, your business needs video too. Giving your developers the best tools is a no-brainer, but project delays are inevitable when you develop everything in-house. Using video SDKs, your business becomes more efficient and can better service customers long-term. When customers have a fantastic experience (and spend more time in your app,) advertisers and investors are happy too!

See It For Yourself:

 

- Bitmovin      - Bitmovin

The post Test Your Streams in Our Player on iOS and Android with the Bitmovin Mobile Apps appeared first on Bitmovin.

]]>