Giter Club home page Giter Club logo

Comments (9)

jlaine avatar jlaine commented on May 13, 2024

Which MediaStreamTrack are we talking about? The want that represents the remote party's media, or the one you write to send media to the remote party?

from aiortc.

saluto avatar saluto commented on May 13, 2024

I mean the remote/incoming stream. Because I want to detect when an incoming track was ended by the remote party (while the peer connection and stream is still alive).

from aiortc.

jlaine avatar jlaine commented on May 13, 2024

OK I'll look into it. Could you elaborate on how you plan to use these events?

The 'ended' event is interesting, but I'm wondering if RemoteStreamTrack.recv() shouldn't also raise an exception, as otherwise a media consumer will stay blocked forever

from aiortc.

saluto avatar saluto commented on May 13, 2024

Right, in that case an exception makes sense. An explicit 'ended' event would still be useful, to handle ended remote tracks in a clean way. (In my usecase the remote client should be able to end and switch tracks, while the python client should remove ended remote tracks from its processing pipeline.)

from aiortc.

saluto avatar saluto commented on May 13, 2024

Thanks for working on that!
I just noticed, that I also need it "the other way round", meaning MediaStreamTrack.stop() (see here) for local tracks, and perhaps RTCPeerConnection.removeTrack(sender) (see here). Should I open a new issue for that?

from aiortc.

jlaine avatar jlaine commented on May 13, 2024

I'm not done yet with emitting 'ended', there are cases where it won't fire (like tearing down the peer connection while it's running). I also don't understand when 'started' is supposed to fire, the MDN docs say nothing about it, so I guess I need to go look at the actual specs.

When you say you want to call MediaStreamTrack.stop(), is this again on the remote media stream track? What's the purpose?

from aiortc.

saluto avatar saluto commented on May 13, 2024

I think, 'started' is not an official event on MediaStreamTrack, only 'mute', 'unmute', 'overconstrained', 'ended', as listed here.
And maybe this helps for the 'ended' event.

MediaStreamTrack.stop() I want to call on the local track. This should set the track state to 'ended' (see here) and the remote (receiving) client should be able to detect this by an 'ended' event. No further data should be sended through that track.

from aiortc.

jlaine avatar jlaine commented on May 13, 2024

OK let's forget about "started" then.

For the second point, as you provide the local track by subclassing MediaStreamTrack I don't think stop() makes any sense : it would do nothing. My suggestion is for you to instead stop the RTCRtpTransceiver, which will send a BYE to the remote party.

from aiortc.

saluto avatar saluto commented on May 13, 2024

Great, thanks! I will try that.

from aiortc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.