arcticfox1919 / vlc-flutter

Flutter plugin for vlc player
MIT License
21 stars 7 forks source link

Support of sdp(Session Description Protocol) file? #4

Open kiam123 opened 2 years ago

kiam123 commented 2 years ago

Hi, i'm using your example, switch to open sdp, but can't use it

pubspec.yaml

flutter:
  assets:
    - assets/

assets/rtp.sdp

v=0
m=video 5002 RTP/AVP 96
a=rtpmap:96 H264/90000
c=IN IP4 127.0.0.1

main.dart

load()async{
    // rtmp://58.200.131.2:1935/livetv/natlgeo
    await _controller.setDataSource(
    // uri: "https://v-cdn.zjol.com.cn/276996.mp4");
    path: "assets/rtp.sdp");
}

ps: sorry, I'm new hand to flutter

arcticfox1919 commented 2 years ago

Not yet supported

kiam123 commented 2 years ago

It would be fine if I changed it to this, but don't know when this is the standard (如果我将它改成这样就可以了,但不知道这样的做法时候标准)

load() async{
     final videoData = await rootBundle.load('assets/rtp.sdp');
     final videoBytes = Uint8List.view(videoData.buffer);
     var dir = (await getTemporaryDirectory()).path;
     var tempVideo = File('$dir/temp.file');
     tempVideo.writeAsBytesSync(videoBytes);
     await Future.delayed(Duration(seconds: 1));
     if (await tempVideo.exists()) {
       await _controller.setDataSource(path: tempVideo.path);
     }
}