Documentation: Accept redirects 301/302 and
  • 08-May-2023
Lightrun Team
Author Lightrun Team
Share
Documentation: Accept redirects 301/302 and

Documentation: Accept redirects 301/302 and “Cleartext HTTP traffic to xxx not permitted”

Lightrun Team
Lightrun Team
08-May-2023

Explanation of the problem

Problem Description:

ExoMedia version: 4.3.0, Device OS version: 10.0, Device Manufacturer: Motorola, Device Name: Motorola One

Expected Result:

ExoMedia should accept the 301 response and redirect to HTTPS version of the linked video.

Actual Result:

2020-11-10 10:45:15.105 32756-1124/mareksebera.cz.redditswipe E/ExoPlayerImplInternal: Source error. com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: Unable to connect to http://i.imgur.com/QljaMs3.mp4 at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:281) at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:250) at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:83) at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:885) at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:381) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919)

Troubleshooting with the Lightrun Developer Observability Platform

Getting a sense of what’s actually happening inside a live application is a frustrating experience, one that relies mostly on querying and observing whatever logs were written during development.
Lightrun is a Developer Observability Platform, allowing developers to add telemetry to live applications in real-time, on-demand, and right from the IDE.

  • Instantly add logs to, set metrics in, and take snapshots of live applications
  • Insights delivered straight to your IDE or CLI
  • Works where you do: dev, QA, staging, CI/CD, and production

Start for free today

Problem solution for Documentation: Accept redirects 301/302 and “Cleartext HTTP traffic to xxx not permitted”

The use of ExoMedia, a library built on top of ExoPlayer, has generated mixed reactions from users in response to a question regarding its use. One user recommended improving documentation to prevent confusion in the future, while another user agreed that the library is stable but pointed out that it uses an older version of ExoPlayer. However, some users criticized the library, citing deprecated implementations and the recommendation to use ExoPlayer directly.

ExoMedia was created to simplify the integration of ExoPlayer into Android applications. It provides additional functionality such as advertisements, subtitles, and analytics. However, the library has not been updated in some time and relies on an outdated version of ExoPlayer. This can result in compatibility issues with newer versions of Android or ExoPlayer itself. Additionally, the use of deprecated methods can result in unexpected behavior and bugs.

One proposed solution to these issues is to migrate from ExoMedia to ExoPlayer directly. ExoPlayer is a standalone media player library that provides a range of features and supports various media formats. It is actively maintained and updated, ensuring compatibility with the latest versions of Android and providing bug fixes and new features. While ExoPlayer requires more effort to integrate than ExoMedia, it offers more control and flexibility. Furthermore, ExoPlayer has good documentation, making it easier to learn and use.

Other popular problems with ExoMedia

Problem: compatibility issues with newer versions of Android

The issue with deprecated code arises when the ExoMedia library relies on features or methods that are no longer supported by newer versions of Android. This can cause issues with compatibility, as newer Android versions may not support the deprecated code.

Solution:

The solution to this issue is to update the ExoMedia library to use newer features and methods that are supported by the latest versions of Android. This can be a time-consuming process, as developers will need to review the code and identify any deprecated features that need to be updated.

Problem: not handle network errors or connectivity issues gracefully

This can lead to buffering and playback issues when streaming media from the internet.

Solution:

The solution to this issue is to implement better error handling in the ExoMedia library. This can involve using more robust network connection libraries, implementing retry logic for failed requests, and displaying error messages to the user when issues arise.

Problem: security

By default, ExoMedia does not support HTTPS connections, which can lead to security vulnerabilities when streaming media over the internet.

Solution:

The solution to this issue is to enable HTTPS support in ExoMedia by configuring the appropriate settings. This can involve setting up SSL certificates and configuring the ExoMedia library to use HTTPS by default. By enabling HTTPS support, developers can ensure that their media player is secure and protected from potential security threats.

A brief introduction to ExoMedia

ExoMedia is a media playback library for Android that is built on top of the ExoPlayer library. It provides a set of UI components and media player controls that can be easily integrated into an Android application. The library is designed to support a variety of media formats, including video, audio, and live streams, and offers features such as playback control, playback speed adjustment, and subtitle support. ExoMedia also provides a customizable interface for creating a seamless user experience.

The core of ExoMedia is based on ExoPlayer, a media player library developed by Google. ExoPlayer is designed to provide high-performance, low-latency media playback across a range of devices and network conditions. It uses a modular architecture that allows developers to customize its behavior and add support for additional media formats. ExoPlayer provides a range of features, such as adaptive streaming, DRM support, and seamless transitions between different media types. ExoMedia builds on top of these features and provides a set of UI components and controls to make it easier to integrate media playback into Android applications.

Most popular use cases for ExoMedia

  1. ExoMedia is a versatile library that can be used for a variety of multimedia applications on Android devices. One popular use case is building video players and audio players within mobile applications. ExoMedia offers a comprehensive set of features that allows developers to customize the playback of media content in their applications. For instance, developers can use ExoMedia to implement adaptive streaming, media caching, offline playback, and many other advanced features.
  2. Another popular use case for ExoMedia is building video and audio streaming applications. ExoMedia provides support for a variety of streaming protocols, including HLS, DASH, and SmoothStreaming, as well as adaptive bitrate streaming. With ExoMedia, developers can create applications that deliver high-quality video and audio content to users with low buffering times and without the need for complex server-side configurations.
  3. ExoMedia can also be used for building advanced multimedia applications that require custom UI components. For example, developers can use ExoMedia to create custom video players with advanced controls, such as subtitle support, playback speed controls, and volume controls. The following code block shows an example of how to create a custom video player using ExoMedia:
PlayerView playerView = findViewById(R.id.player_view);
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
playerView.setPlayer(player);

MediaItem mediaItem = MediaItem.fromUri(videoUri);
player.setMediaItem(mediaItem);

player.prepare();
player.play();

In summary, ExoMedia is a powerful library that can be used for a variety of multimedia applications on Android devices. It provides support for advanced features such as adaptive streaming, media caching, and offline playback, as well as a variety of streaming protocols. Additionally, it allows developers to create custom UI components for video and audio players, enabling them to provide a unique and engaging user experience for their applications.

Share

It’s Really not that Complicated.

You can actually understand what’s going on inside your live applications.

Try Lightrun’s Playground

Lets Talk!

Looking for more information about Lightrun and debugging?
We’d love to hear from you!
Drop us a line and we’ll get back to you shortly.

By clicking Submit I agree to Lightrun’s Terms of Use.
Processing will be done in accordance to Lightrun’s Privacy Policy.