Comments (10)
Thanks for all these useful info. There's not a lot of sources on how to achieve this and I'll look more into Cast documentation but I have no idea how to remove the sessions since that's what I was trying to do originally. I'll keep looking and keep you posted. Thanks again
from mediaelement-plugins.
Can you do me a favor: in Chromecast.js create a method called cleanchromecast and put the code you use the code you set up to remove the current session and see if it does any good
from mediaelement-plugins.
Also take a look at this Fiddle and see if anything could work for you: https://jsfiddle.net/gurupras/sgLfcocq/
from mediaelement-plugins.
I fond this snippet and maybe that's the answer. Can you try using this?
function stopCasting() {
var castSession = cast.framework.CastContext.getInstance().getCurrentSession();
// End the session and pass 'true' to indicate
// that receiver application should be stopped.
castSession.endSession(true);
}
from mediaelement-plugins.
I had already tried the last snippet but I added it to cleanchromecast(), added it on unmounting and all combinations I could come up with. Regardless of how you end the session, if you open chrome's console immediately afterwards, get the context instance (window.cast.framework.CastContext.getInstance()
) and request a session (session.requestSession()
), previous cast resumes. Apparently we need to kill the context, because as soon as you request a session on the same context everything you did on that context is still there.
I'm going to explore the fiddle you sent, but I believe the best and cleanest solution is to reset the context rather than having to handle sessions and a lot of code that I don't really need.
I tried removing the entire cast framework on unmounting with that purpose but that generates a lot of errors and I can't get it to cast again.
I'm going to keep digging...
from mediaelement-plugins.
I tried creating a new context, since it's a singleton it should replace the previous one but apparently you cannot get a session from it so chomecast.js throws and error. Also tried to set up a castOption: resumeSavedSession
to false but no luck...
from mediaelement-plugins.
Thanks I'll keep looking in the documentation about how to do this properly or I'll ask the question directly if I'm at lost
from mediaelement-plugins.
@sergioavazquez I have updated the plugin with a missing workflow to avoid loading a request more than once, and destroying Cast session properly. Please download the master branch and let me know if it worked for you. I tested on my local ReactJS env and seemed to work just fine.
from mediaelement-plugins.
@rafa8626 you nailed it! It's working like a charm...
from mediaelement-plugins.
Excellent news!! Thanks for testing this good team work
from mediaelement-plugins.
Related Issues (20)
- mediaelementjs marker plugins not working with youtube link or embed HOT 1
- how do i add a subtitle in a11y plugin HOT 1
- Picture-in-Picture plugin isn't build like other plugins ? HOT 1
- Add audio track switcher HOT 1
- Picture-in-Picture don't work when Player is load m3u8 LiveBroadcast
- Quality plugin plays mp4 first by default (2nd <source>) and only switches source once. HOT 2
- Error on building Player using playlist plugin on safari
- Quality switch doesn't work with m3u8 file HOT 1
- Audio description in a11y not working for external YouTube videos
- End behavior differs depending on during-play action
- Broken Controls display
- Timeslider disappearing with individual settings
- Audio file storage
- mediaelement Web site problems HOT 1
- Help in Ads plugin to run on specific event HOT 10
- Player SBS, TaB (3D) to anaglyph or VR
- Playlist plugin fails at the end of playlist run
- Playlist fails to play next audio after first ends HOT 1
- Change color of audio player
- HLS Quality Selection
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mediaelement-plugins.