How to play HLS (HTTPs live stream) videos on your Android TV App?

Поделиться
HTML-код
  • Опубликовано: 21 авг 2024
  • In this video it shows the steps to develop your Android TV App to play HLS (HTTPs live stream) videos.
    It uses sample HLS video available at: ottverse.com/f...
    During the development of this App, below error was observed in debugging:
    "No suitable media source factory found for content type: 2"
    This is fixed by implementing the below HLS libraries in the Gradle file.
    implementation("androidx.media3:media3-exoplayer-hls:1.3.0")
    I hope you like this video. For any questions, suggestions or appreciation please contact us at: programmerworl... or email at: programmerworld1990@gmail.com
    Complete source code and other details/ steps of this video are posted in the below link:
    programmerworl...
    However, the main Java code is copied below also for reference:
    package com.programmerworld.hlsintvapp;
    import android.os.Bundle;
    import android.view.View;
    import androidx.activity.EdgeToEdge;
    import androidx.appcompat.app.AppCompatActivity;
    import androidx.core.graphics.Insets;
    import androidx.core.view.ViewCompat;
    import androidx.core.view.WindowInsetsCompat;
    import androidx.media3.common.MediaItem;
    import androidx.media3.exoplayer.ExoPlayer;
    import androidx.media3.ui.PlayerView;
    public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    EdgeToEdge.enable(this);
    setContentView(R.layout.activity_main);
    ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) - {
    Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
    v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
    return insets;
    });
    }
    public void buttonStartHLS(View view){
    ExoPlayer exoPlayer = new ExoPlayer.Builder(this).build();
    exoPlayer.setMediaItem(MediaItem.fromUri("demo.unified-s..."));
    exoPlayer.prepare();
    PlayerView playerView = findViewById(R.id.playerView);
    playerView.setPlayer(exoPlayer);
    }
    }
    --

Комментарии • 3

  • @PinaColada65
    @PinaColada65 2 месяца назад

    Nice tutorial! helped a lot! Can you guide on how we can download these hls streams in our device?

  • @Yes-My-Fun
    @Yes-My-Fun 4 месяца назад

    hi thanks for video, I upload play console, My App its rejected (below the mail) please make video this issue:::
    Issue found: No full-size app banner and/or icon
    Your app should contain a full-size app banner and icon that is visible in the launcher. We are targeting 1080P, which we consider xhdpi. Apps should include the banner in the xhdpi (320 dpi) drawables folder with a size of (320px × 180px) and the icon with a size of (512px x512px). Please refer to our Home screen banner.
    The title should help users identify apps in the launcher. Please refer to our Visual design and user interaction documentation for more information.
    Your icon does not fill the entire icon space.
    thank-you

    • @ProgrammerWorld
      @ProgrammerWorld  4 месяца назад

      This is more to do with the images required for hosting the App on play store. They need images of different sizes which will appear on play store under your published app page. So, if it is not as per the requirement Google will not publish the App and request for the same.
      Try to provide the images in the dimensions requested by the Play store.
      programmerworld.co/android/how-to-play-hls-https-live-stream-videos-on-your-android-tv-app/