Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to play rtmps url #34

Open
cbakchi opened this issue Jul 15, 2021 · 2 comments
Open

Unable to play rtmps url #34

cbakchi opened this issue Jul 15, 2021 · 2 comments

Comments

@cbakchi
Copy link

cbakchi commented Jul 15, 2021

I was trying to play the rtmps link using ext_video_player
rtmps://dlive.flavorable.io:443/live/apa.dummy@gmail.com

But It's throwing below exception. In fact it's not able to detect rtmps protocol. I am using ext_video_player: ^0.0.6

Could you please help us on that?

--------- Log message ----------------
E/ExoPlayerImplInternal( 4844): Playback error
E/ExoPlayerImplInternal( 4844): com.google.android.exoplayer2.ExoPlaybackException: Source error
E/ExoPlayerImplInternal( 4844): at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:554)
E/ExoPlayerImplInternal( 4844): at android.os.Handler.dispatchMessage(Handler.java:102)
E/ExoPlayerImplInternal( 4844): at android.os.Looper.loop(Looper.java:223)
E/ExoPlayerImplInternal( 4844): at android.os.HandlerThread.run(HandlerThread.java:67)
E/ExoPlayerImplInternal( 4844): Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: Unable to connect
E/ExoPlayerImplInternal( 4844): at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:309)
E/ExoPlayerImplInternal( 4844): at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:199)
E/ExoPlayerImplInternal( 4844): at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:84)
E/ExoPlayerImplInternal( 4844): at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1013)
E/ExoPlayerImplInternal( 4844): at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:415)
E/ExoPlayerImplInternal( 4844): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/ExoPlayerImplInternal( 4844): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/ExoPlayerImplInternal( 4844): at java.lang.Thread.run(Thread.java:923)
E/ExoPlayerImplInternal( 4844): Caused by: java.net.MalformedURLException: unknown protocol: rtmps
E/ExoPlayerImplInternal( 4844): at java.net.URL.(URL.java:608)
E/ExoPlayerImplInternal( 4844): at java.net.URL.(URL.java:498)
E/ExoPlayerImplInternal( 4844): at java.net.URL.(URL.java:447)
E/ExoPlayerImplInternal( 4844): at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.makeConnection(DefaultHttpDataSource.java:468)
E/ExoPlayerImplInternal( 4844): at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:307)
E/ExoPlayerImplInternal( 4844): ... 7 more
I/flutter ( 4844): snapshot.connectionState :ConnectionState.done

@bardia-mhd
Copy link

Searching thoroughly over the internet, I found a few examples which involved using Native FFMPEG code on Android to receive and decode the RTSP stream and render it directly over the SurfaceView using NativeWindow interface. Following this, I was able to get a stream with minimum latency.

Following this flutter Vlc player package can handle rtsp streams.

https://pub.dev/packages/flutter_vlc_player

Flutter Vlc player package can handle rtsp streams.

flutter_vlc_player

This is the example from the readme section.

import 'package:flutter/material.dart';
import 'package:flutter_vlc_player/flutter_vlc_player.dart';

class ExampleVideo extends StatefulWidget {
  @override
  _ExampleVideoState createState() => _ExampleVideoState();
}

class _ExampleVideoState extends State<ExampleVideo> {
  final String urlToStreamVideo = 'http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_60fps_normal.mp4';
  final VlcPlayerController controller = new VlcPlayerController(
      // Start playing as soon as the video is loaded.
      onInit: (){
          controller.play();
      }  
  );
  final int playerWidth = 640;
  final int playerHeight = 360;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: SizedBox(
            height: playerHeight,
            width: playerWidth,
            child: new VlcPlayer(
                aspectRatio: 16 / 9,
                url: urlToStreamVideo,
                controller: controller,
                placeholder: Center(child: CircularProgressIndicator()),
            )
        )
    );
  }
}


@neevista
Copy link

@bardia-mhd - Are you referring to RTSP or "RTMPS" (secured RTMP) stream?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants