Git Product home page Git Product logo

popcorn-js's Introduction

This project is no longer maintained

Mozilla no longer maintains this project. There is a fork with more active development here, if you're interested in further development of PopcornJS you may want to check that out.


Popcorn.js

Mozilla's HTML5 Video Framework

Overview

Popcorn.js is Mozilla's HTML5 video and media library for the open web. It allows web developers, filmmakers, artists, designers and others to easily create timeline based web productions. Popcorn.js helps simplify media API and implementation differences between browsers and includes a powerful event system and a rich plugin architecture and plugins.

Popcorn.js can be used with almost any media type you can imagine, from HTML5 audio and video, to YouTube and Vimeo, to SoundCloud, etc. Popcorn.js also has plugins to allow content from popular web sites and services to be integrated easily, for example, Wikipedia, Facebook, Google Maps, etc.

Anything you can do on the web can be turned into a Popcorn.js plugin, and become part of a timeline-based web experience. Popcorn.js breaks video out of the box and allows media to fully interact with the rest of the web.

Try a live code example here.

Community

The Popcorn.js community is a mix of developers, filmmakers, artists, and everything in between. If you are interested in using Popcorn.js or helping us build it, you can use one or more of the following:

For Developers

You can follow the project's bugs and activity here.

For Plugin Authors

Popcorn.js offers a powerful plugin architecture. Plugins are a way for developers to wrap web functionality and allow it to be placed on a timeline, responding to a point in a video or other media resource.

Take a look at our growing gallery of officially supported plugins.

Have you built a cool plugin, or have an idea for one? Let us know!

License

Popcorn.js is made available under the MIT License.

Acknowledgements

Popcorn.js is built and maintained by a growing community, with the support of:

Changelog

A changelog can be found here.

popcorn-js's People

Contributors

admix avatar annasob avatar boazsender avatar brettgaylor avatar brianchirls avatar cadecairos avatar cstigler avatar danventura avatar db48x avatar dhodgin avatar drigato avatar dseif avatar gphemsley avatar humphd avatar ilyakatz avatar jbuck avatar jptweb avatar k88hudson avatar mapmeld avatar mbuttu avatar minoo avatar mjschranz avatar pomax avatar projjol avatar rwaldron avatar scottdowne avatar secretrobotron avatar stanica avatar stevenaw avatar vvasabi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

popcorn-js's Issues

Vimeo wrapper - setting width and height

Hi,

I am having trouble understanding how width and height are set on a Vimeo video element instance

the code in the wrapper tries to get the width and height from the parent element (a div in my case)

but I could only get it working when setting dimensions as inline styles and replacing line 79 and 80 with :

width: parseInt(parent.style.width)|0 ? parseInt(parent.style.width) : MIN_WIDTH,
height: parseInt(parent.style.height)|0 ? parseInt(parent.style.height) : MIN_HEIGHT,

Also I could not set a width or height in the options when creating the player

I am probably doing something wrong but would lova a little help

thnks

Frame rate not passed when using .play() or .pause()

On line 535 of the downloadable uncompressed version of popcorn.js Popcorn.util.toSeconds does not pass this.options.frameRate as a second argument.

The same is true for line 594 of the exec method.

EDIT: There are actually multiple calls to the toSeconds method from within popcorn where it doesn't pass the frameRate option and in addition to that, there are places where "framerate" is used instead of "frameRate"

Youtube unstarted state

Hi,

In the Youtube Player API documentation, they mention an unstarted state (-1).

This state is triggered when playing videos part of a list, like these ones: http://www.youtube.com/watch?v=ZXrHkIz-krE&list=PLjTlxb-wKvXNSDfcKPFH2gzHGyjpeCZmJ&index=1

For the moment, the Youtube's wrapper does not trigger this state so it's impossible to catch it from the outside (except by listening to message posted by the Youtube's iFrame).

I've did it in my own version of Popcorn-JS, taking the shortest path: arnaudbreton@484e9c9

I'm now wondering how to integrate it in the official version, using the cleaner solution?

Thanks for your help.

Chrome beta on mobile not playing via #play()

Hi,
Looks like Chrome beta (possibly non-beta too) not playing via the #play() interface.

To reproduce, hook remote debugging to your mobile device, and within Chrome Beta, go to http://popcornjs.org and issue a Popcorn('#video').play() in the Javascript Console on your desktop (which is remote debugging the mobile Chrome).

Nothing will happen.

Thanks.

XHR Post

Popcorn doesn't set the content-type to "application/x-www-form-urlencoded" before sending POST data with Popcorn.xhr. Is there a reason for this? I can't seem to handle the request server-side (at least with PHP) without setting it.

Thanks!

Password protected Vimeo - Events don't fire

When the Vimeo video is password protected the player is created but with Vimeo's password overlay (as you'd want). However no events are fired either before or after entering the password.

I have tried most events and none of them fire.

As an example I have Big Buck Bunny hidden behind a password.

  1. Enter password: hippo
  2. See no events firing
  3. Press play
  4. Still no events
  5. Re-run fiddle
  6. See 'durationchange' is fired
  7. Press play
  8. Lots of 'timeupdate' events

(Posted on SO as well)

CSS support for styling players

I wonder if it's easy to style the video players easily with CSS on popcorn-js?

Most 3d party video players like videojs place new div elements for the control bar, the play button etc so that it becomes easier to syle.

Does popcorn-js have/allow this?

play() with time parameter not working on iOS 7

Calling play(N) with a time parameter N does not work on iOS 7. The clip will start playing at the beginning. The only way I could get it to start playing at a specified time was to use currentTime(n), bind a listener to the 'seeked' event, and then call play() in the associated callback.

Webpage iFrame does not work locally

src tag points to file://url

Line 68 in popcorn.webpage.js is messing up local pages

options.src = options.src.replace( /^(https?:)?(//)?/, "//" );

The intention behind the line seems to be used as a user friendly option but the consequence is it fails to load webpages when ran locally.

No player UI for SoundCloud

I'm writing an app that plays music from YouTube and SoundCloud. I have a big area where the videos are shown, and when I play something from SoundCloud, I'd like to show SoundCloud's embedded player UI instead.

Unfortunately, popcorn only supports playing audio from Soundcloud and hides the entire player UI. After reading the code there seems to be no way to turn this on via optional setting either.

Are there any plans to support this in the future? Would you accept a pull request if I where to implement this?

Is it Possible to bypass the autoplay limitation on Safari Mobile.

Hi,

I'm experiencing some troubles with Safari Mobile limitations concerning the first interaction requirement that prevent the audio to start by the programmatic way.
Does Popcorn.js allow to bypass this limitation? Do any of you know any alternative solution?

Sincerely.

Rename tags to be compatible with semver format

Because of different versioning format from Bower one(called Semantic Versioning. see semver.org, I am not able to install latest version of Popcorn.js via Bower(using command "$ bower install popcornjs").

So, could you rename the tags to be compatible with semver format?

For example,
v1.3 -> v1.3.0
v1.2 -> v1.2.0

Code Plugin - Passing more than one rule

When using the popcorn.js code plugin, is it possible to pass more than one start/end rule object? I realize I could very easily call the code() method as many times as I needed, but I just wanted to see if there was already an elegant way to handle this.

The documentation shows how to use one rule like this:

var pop = Popcorn( "#video" );

pop.code({
    start: 1,
    end: 3,
    onStart: function( options ) {
        document.getElementById( "test1" ).innerHTML = "Yes";
    },
    onEnd: function( options ) {
        document.getElementById( "test1" ).innerHTML = "No";
    }
});

Thanks!

SRT parser crashes when file start with a blank line

Hi,

I've just started to use PopcornJS which is awesome to handle these many video providers!

I'm working with subtitles, in SRT format, from Coursera (http://coursera.org) and their subtitles start with a blank line.

When I parse this file, it crashes, line 63 (idx = time[1].indexOf( " " )).

Thanks for your help.

baseplayer and playbackRate()

Running playbackRate() on a baseplayer element returns 'undefined', and setting it doesn't seem to affect the apparent rate at which it plays.

disclaimer: i'm using CDN'd popcornjs, so sorry if this is a dupe

Preloader

Hi,

Another newbie post.

How do I show a vid is loading? In other words how do I show a loading animation while the video is loading.

plugin start function is not called after looping

Hello,

I have a plugin that displays a div above the video. I set the start param to 0.
The start function of my plugin is called when the video starts. But if the video loops then the start function is not called again.

I noticed that when i change the start param to 1 then the start function is called again after looping.

I need the start function to be always called after looping.

Regards,
Lion

How to loop a popcorn.js sequence?

I have created a simple sequence of videos using popcorn.js following the documentation: http://popcornjs.org/popcorn-docs/modules/#sequence

I need the sequence to loop after ending so I added a listener like:

function playsequence(){
    sequence.play();
}
sequence.listen( 'canplaythrough', playsequence );
sequence.listen( 'ended', playsequence );

The thing is that when the sequence ends, the last video is repeated once and then it stops.

Any idea on how could I get a loop for the entire sequence?

IE10: dispatchEvent doesn't trigger binded custom events in case call play() from click

Hi!

I'm using popcorn null wrapper and in IE10 custom events may not be triggered in case calling play() from click event.

It sounds strange, but please check my example here: http://fiddle.jshell.net/vadim_bulochnik/7wtRL/2/show/

You can see that in IE10 only 'play' event fires, while in all other browsers 'timeupdate' event also fires (and in IE11 also ok).
I've tried to debug this issue and found that sometimes IE10 just ignores document.dispatchEvent() in popcorn._MediaElementProto.js on line 120.

After googling I found that seems this is a known bug:
http://connect.microsoft.com/IE/feedback/details/786395/dispatchevent-doesnt-trigger-click-when-called-from-on-click-reactivated
http://connect.microsoft.com/IE/feedback/details/802397/ie9-ie10-events-can-be-sent-to-the-wrong-listeners

Have you ever experienced a similar problem? Maybe there is a workaround?

Thanks!
Vadim

Privacy concern with included JWPlayer. Any alternative?

Hi

I have some privacy concerns with the included JWPlayer wrapper. It seems to phone home with information regarding which video the user is watching and the IP of the user, and it's impossible to turn off. http://www.longtailvideo.com/support/forums/jw-player/bug-reports/29508/jw6-phones-home-privacy-concerns/

I just wonder if you could give me any advice regarding plans to support other wrapped players that can be used as flash fallback for video/mp4?

Thanks!

Trim video?

Hello,

Is it possible to use Popcorn-js in order to trim a video?
Meaning - set start point and end point on the video timeline, and create a new video instance of the trimmed section?

Imprecise timing in Firefox

I have some plugins that I'm trying to have as precise as possible. Changing to frameAnimation: true improved precision, and it Google Chrome it works perfectly.* In Firefox, the timing is at least a tenth of a second off. When dealing with certain things like muting specific words within a sentence, this can make or break the application.

  • or at least well enough to be indistinguishable from perfect timing

Make parsers available (again) on Popcorn.parsers, keyed by filetype

As far as I can tell it used to be possible to access active Parsers through the Popcorn.parsers object, on which they were keyed by filetype extension. Fourteen months ago, as part of a commit affecting the parser module, the line responsible for adding the parsers to this object was modified and commented out. It hasn't been touched since.

The associated t297 doesn't seem to give any reason for this particular change. The current behaviour seems to be to assign Popcorn.parsers = {};, but never use the object again. This doesn't seem like intended behaviour.

I'm working on a patch for Butter that would allow parseable files to be imported by dropping them on the timeline. The only way to find parsers now seems to be to iterate over the Popcorn prototype and look for properties matching /^parse/. I'd like to see the functionality return, either by restoring the original line or something new.

Is it possible to add the subtitles created with the SRT parser to a document element with a custom id?

The subtitle plugin has the option to specify the id of the document element that the content is appended to:

Example:

var p = Popcorn('#video')
    .subtitle({
        start:            5,                 // seconds, mandatory
        end:              15,                // seconds, mandatory
        text:             'Hellow world',    // optional
        target:           'subtitlediv',     // optional
    } )

But when I use the SRT parser I can't find a way to display the subtitles in a document element with a custom id.

If I add the id of the document element directly to the code of the srt parser, it works:

    sub.text = sub.text.replace( /&lt;(\/?(font|b|u|i|s))((\s+(\w|\w[\w\-]*\w)(\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+))?)+\s*|\s*)(\/?)&gt;/gi, "<$1$3$7>" );
    sub.text = sub.text.replace( /\\N/gi, "<br />" );
    sub.target = "the-id-of-my-document-element"; // <---- THIS IS MY ADDITION
    subs.push( createTrack( "subtitle", sub ) );

But it would be much better and useful to have the possibility to specify the id of the target document element as an argument of the parser.

Is it possible?

Thanks

TypeError when data-timeline-sources points directly to file (no path)

Using this code:
<video data-timeline-sources="subs.ttml" ...>
gives:
TypeError: 'null' is not an object (evaluating 'source.match( /(.*)[/]([^/]+.\w+)$/ )[ 2 ]')
in popcorn-complete.js:2794

Changing data-timeline-sources to "./subs.ttml" seems to work, not a critical bug in my book :).

Just came across popcorn-js after a few days searching for something to handle ttml-subtitles without using flash, this looks promising!

webpage plugin iframe scrolling option

Hi all, I think it would be useful to be able to set the HTML "scrolling" option on iframes for the webpage plugin. Scroll bars can look ugly, and it's not alway possible to hide it with CSS, here is a patch I made : mammique@e49684b

Bests,

Camille.

Play from 3 secs to 5 secs

Hi,

newbie here.

I need to add a listener that will play a video between a specified range. Like say between 3 seconds and 5 seconds. Then the video should stop at the 5 second mark.

If i click on a button the video should seek to the 3 second mark, play to 5 seconds and stop.

I am sure there is a simple answer but my javascript really sucks.

Thanks

HTMLYouTubeVideoElement doesn't trigger an error event when the set src doesn't match any video

The changeSrc function sends an JSONP request to get the duration of the video. If this request returns no data (ie the video id doesn't match any video) it logs a message to the console and returns silently instead of triggering an error event.

The HTMLVideoElement for example in that case triggers an error event and the error property is set with a MEDIA_ERR_SRC_NOT_SUPPORTED MediaError (see http://jsfiddle.net/popcornjs/D88FP/)

parseSRT - Works fine with YouTube on Chrome, not on Firefox.

Perhaps a personal issue, rather than a global one, but it's one I can't get round. Using the YouTube player I'm loading my .srt successfully in all browsers, but the subtitles only appear in their assigned div in Chrome. FF displays nothing at all.
Basic version of my code here: Gist

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.