menismu / popcorn-js

The HTML5 Media Framework
MIT License
202 stars 29 forks source link

Loading new media source into Smart Media Wrapper? #35

Open menismu opened 6 years ago

menismu commented 6 years ago

Issue reported: https://github.com/mozilla/popcorn-js/issues/427 Reported by: @apricated

@apricated apricated commented on 30 Dec 2014 I have a designated #player element on a page, and can load media into it via a Popcorn instance. However, if I wanted to load media from another source (and replace the old media with it), what would be the most efficient way to do that?

Some background: I've experimented with the src attribute and load method for the Popcorn instance, but couldn't get this to work. I then tried a combination of clearing the children of the #player element (which removes the iframe/player appended from YouTube, Soundcloud, etc.), and running a destroy method on the Popcorn instance; but this is resulting in constant barrage of errors in the console, saying:

Uncaught TypeError: Cannot read property 'postMessage' of null

Can I reuse a Popcorn Smart Media Wrapper, or is there some other method than what I've tried which is more efficient and less error prone?

@socialtechno socialtechno commented on 30 Dec 2014 I find @brianchirls Inception plugin very useful for that, but I have not tried it with the smart wrapper. https://github.com/brianchirls/popcorn-inception