Code Monkey home page Code Monkey logo

video-js-swf's Introduction

This project is no longer maintained as Adobe Flash is being End-of-lifed.

The lightweight Flash video player for Video.js. This allows the Video.js player's skins, plugins, and other features to work with both HTML5 and Flash.

This project doesn't need to be used if you simply want to use the Flash tech in Video.js.

Installation

  1. Install Node Packages.
    npm install
  1. Compile SWF. Development (places new SWF in /dist/):
    grunt mxmlc

Production/ Distribution (runs mxmlc task and copies SWF to dist/):

    grunt dist
  1. Run Connect Server.
    grunt connect:dev
  1. Open your browser at http://localhost:8000/index.html to see a video play. You can keep using grunt to rebuild the Flash code.

Releasing

  1. Make sure that the following file is modified with these values:
node_modules/flex-sdk/lib/flex_sdk/frameworks/flex-config.xml
<!-- Specifies the minimum player version that will run the compiled SWF. -->
<target-player>10.3</target-player>

<!-- Specifies the version of the compiled SWF -->
<swf-version>12</swf-version>
  1. Run the commands:
npm version {major,minor,patch}
npm publish

The swf and changelog will be automatically built and added to the repo on version.

Running Unit and Integration Tests

** Note - We want to drop all of this for grunt based / Karma testing.

For unit tests, this project uses FlexUnit. The unit tests can be found in [project root]/src/com/videojs/test/

For integration tests, this project uses qunit. The integration tests can be found in [project root]/test

In order to run all of the tests, use the links at http://localhost:8000/index.html

There are very few tests. Adding to them is a fantastic and much appreciated way to contribute.

video-js-swf's People

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

video-js-swf's Issues

`waiting` event is being fired after `ended`

This is a hot issue if anyone's able to give some quick feedback.

Example: http://jsfiddle.net/heff/N8Zs5/
(The spinner will show after the video has ended)

Reported in videojs/video.js#708

My best guess is the cause is the NetStream.Buffer.Empty event handler.

It would make sense that this would fire after the video ends and the buffer is empty, but we shouldn't be firing the waiting event if we're not actually waiting for more data. I don't understand the netstream operation enough to dig much deeper and understand the best way to fix this.

This is a relatively new issue, though it could be caused by the fact that the player no longer manually seeks back to zero when the video ends.

A quick work around in JS layer would be to check the 'ended' property and block waiting events that happen while ended, except that the ended property in HTTPVideoProvider is set to always return false. I'm interested to know if there's a reason for that, because the other providers (Audio/RTMP) will return true when ended.
https://github.com/videojs/video-js-swf/blob/master/src/com/videojs/providers/HTTPVideoProvider.as#L180

muted set function propably accessing wrong field name

Hi,

in the VideoJSModel.as class, line 280 and 283, i think that the field accessor has a typo.

https://github.com/zencoder/video-js-swf/blob/master/src/com/videojs/VideoJSModel.as#L276

Instead of "volume", "_volume" should be the correct identifier, i think.

Update: That was all wrong. See comments below.

This currently leads to the issue, that sound cannot be turned on again after having it turned off.

There is a related issue in the main videojs project, please set that to fixed as well, once this one is fixed.
videojs/video.js#223

HTTP pseudo-streaming support

Hello.
Look please whenever possible at adding function of HTTP pseudo-streaming.
I unfortunately don't have knowledge for full implementation of this functionality, but in fact if I am not mistaken - everything simply.

Here an example of implementation from other player:

 if (_pseudoStreamingEnabled) {
      sendEvent(HtmlMediaEvent.SEEKING);
      // Normal seek if it is in buffer and this is the first seek
      if (pos < bufferPosition && _seekOffset == 0) {
        _stream.seek(pos);
      }
      else {
        // Uses server-side pseudo-streaming to seek
        _stream.play(getCurrentUrl(pos));
        _seekOffset = pos;
      }
    }
    else {
      sendEvent(HtmlMediaEvent.SEEKING);
      _stream.seek(pos);
    }
 private function getCurrentUrl(pos:Number):String {
    var url:String = _currentUrl;
    if (_pseudoStreamingEnabled) {
      if (url.indexOf('?') > -1) {
        url = url + '&' + _pseudoStreamingStartQueryParam + '=' + pos;
      }
      else {
        url = url + '?' + _pseudoStreamingStartQueryParam + '=' + pos;
      }
    }
    return url;
  }

Thanks in advance even for attempt to look in this side.

Firefox needs mousemove events from Flash

(Discovered in videojs/video.js#691 and mentioned by bkelley in IRC #videojs)

With the latest control bar updates in video.js core (in master, not released yet) we moved to tracking mouse/touch events to determine when the controls should be visible. Other browsers emit mousemove events from swf element, but Firefox does not, meaning once the controls hide, they never show again.

bkelley has a partial fix but it causes flickering of the control bar (because of mouseouts bubbling from control elements) and this shouldn't work in fullscreen when you can't ever mouse out of the player area.

The real fix will be to bubble mouse move events from the swf to the JS layer. It can probably be implemented in the same way as the stageclick event in the following lines. However we'll need to make sure we're not doubling up the mouse events in browsers that do fire mousemoves for the swf element.

stage.addEventListener(MouseEvent.CLICK, onStageClick);

private function onStageClick(e:MouseEvent):void{

public static const ON_STAGE_CLICK:String = "stageclick";

Click event in the swf have unexpected outcomes.

Right click on video while video is playing.

There are two issues related to click events in the swf while a video is being played.

Visual playback stops when the screen is right clicked
But video doesn't actually stop, it keeps rolling.

Right click on video
Select settings
Click in the settings dialog
When adjusting settings, any click on the settings will start/stop video

XSS vulnerability in video-js.swf

Vulnerable code:
if(loaderInfo.parameters.readyFunction != undefined){
try{
ExternalInterface.call(loaderInfo.parameters.readyFunction, ExternalInterface.objectID);
}
PoC:
video-js.swf?readyFunction=alert%28document.domain%29

Calling preventDefault() on error events will prevent errors from displaying in the Flash debug dialog

In VideoJS.as, there are these comments:
// we'll want to suppress ANY uncaught debug errors in production (for the sake of ux)
// IEventDispatcher(loaderInfo["uncaughtErrorEvents"]).addEventListener("uncaughtError", onUncaughtError);

In a separate code review, I asked:
Does this suppression prevent the Flash debug dialog from appearing when using the debug version of the player? I'd suggest that we allow errors to surface in the debug player, and if this only applies to using the release player (where I agree, we don't want to surface Flash errors), then ignore this comment.
alemay 4 minutes ago

And Andy answered:
The debug player will still display the typical error modal, unless you call preventDefault() on the error event - which we're doing, and which should probably change.

We should not call preventDefault on error events, so that users can send us as much information as possible when errors (especially uncaught errors) occur.

video-js-swf has no stable branch - breaks contribflow

Found while investigating #30.

I tried creating a hotfix branch to fix that issue, using contribflow, but contrib hotfix create failed with this output:

jwhisenant-retina:video-js-swf jwhisenant$ contrib hotfix start
prompt: Name of the hotfix:  issue-30
-----> Fetching upstream
$ git fetch upstream
From https://github.com/videojs/video-js-swf
 * [new branch]      add-context-menu -> upstream/add-context-menu
 * [new branch]      audio      -> upstream/audio
 * [new branch]      master     -> upstream/master
 * [new branch]      media-source -> upstream/media-source
-----> Creating the stable branch based on remotes/upstream/stable
$ git checkout -b stable remotes/upstream/stable
fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'remotes/upstream/stable' which can not be resolved as commit?
-----> Process aborted
-----> Exit status: 128
-----> You may need to run any following commands manually...
-----> Pushing the stable branch to origin
$ git push origin stable
-----> Tracking the stable branch against origin/stable
$ git branch --set-upstream stable origin/stable
-----> Switching to the stable branch
$ git checkout stable
-----> Updating the stable branch with upstream changes
$ git pull upstream stable
-----> Creating the hotfix/issue-30 branch based on stable
$ git checkout -b hotfix/issue-30 stable
-----> Pushing the hotfix/issue-30 branch to origin
$ git push origin hotfix/issue-30
-----> Tracking the hotfix/issue-30 branch against origin/hotfix/issue-30
$ git branch --set-upstream hotfix/issue-30 origin/hotfix/issue-30
-----> Ready to start building your hotfix in branch hotfix/issue-30.

Choppy video in fullscreen

Open up the player
Go full screen

Expected: smooth playback of video
Actual: very choppy video, audio seems unaffacted

Force fullscreen

Hi, is it possible to make it so that it can do fullscreen mode in an iframe in older browsers?
the iframe attribute "allowfullscreen" doesnt work for IE7-9.

So my idea is to have html5 for serious browsers like chrome and firefox, and force flash on IE, because I think flash can run fullscreen inside an iframe without needing to allowing it in the iframe. Youtube does it.

Update publishing process to include a compiled swf

Currently the swf npm package has an install/postinstall script that runs the grunt task to generate the swf from source. The video.js core project will rely on this to get its copy of the swf. This isn't ideal because:

  • It make flex-sdk a dependency (not just devDependency), which means it gets download loaded whenever the swf project is installed, and it's 168 MB
  • It requires every user to have the grunt CLI already installed
  • The task may or may not work on Windows, we need to check

The best approach is probably to do what we've discussed doing with video.js, where you gitignore the dist directory, and git add --force the compiled swf whenever we bump the version of the swf.

Memory leak on changing src

When changing the src of a video, the memory footprint grows linearly.

var interval=2000;
var changeSrc=function(player, src) {
    setInterval(function() {
        player.pause().src(src).play();
    }, interval);
};
videojs("main_video", { "techOrder": ["flash", "html5"] }).ready(function () {
    changeSrc(this, 'http://vjs.zencdn.net/v/oceans.mp4');
});

Example: http://jsfiddle.net/fwcJh/36/ After a minute or so Iโ€™m at 2 GB of RAM usage of the Flash plugin.

Passing RTMP link

Hi,

Thanks for adding rtmp support.

what is the format of the rtmp link ? is it documented somewhere ?

thanks

Progress bar's buffer point is very inaccurate (feature/hls)

Start Socrates (make sure it is linked properly to video.js and video-js-swf)
Select 'Brightcove MBR, 16x9, 608k rendition' test case
Play video
Scrub near to the end of the buffer zone on the video

Expected:
Video plays without any delays

Actual:
Video will wait and load, telling us that the buffer zone is a little inaccurate.

Console log reports current bitrate at 0bps on feature/hls

Set video-js-swf and video.js to their feature/hls branches.
Load the player through the server
Click play and open up the developer console
Look for:
[vid1_flash_api] 0 bits per second (bps) [HLS Benchmark]

Expected:
Current bitrate shown

Actual:
A bitrate of 0 shown

Aspect Ratio Progress?

I am curious to see if there has been any progress with the aspect ratio problem? I have seen multiple threads with no good fix yet, and those were a few months ago. Or is there an estimated time that this will be fixed?

Thanks, Dan.

Add support for HTTP pseudo-streaming

It would be good to have support for HTTP pseudo-streaming for MP4 and FLV video. Most of HTTP servers today provides this functionality, but videojs player does not handle it.

HLS support using mangui/HLSProvider

Hi folks,

I see there is ongoing effort to add HLS support in video.js by rewriting a provider from scratch. I am not clear about the progress of the development, but if by any chance you are interested, I can contribute on providing a HLS provider based on https://github.com/mangui/HLSprovider, which provides an API and a swc file that should ease the work and abstract the mess behind this protocol, supports a bunch of tag, encrypted streams, ...
Cheers,
Mangui

Manifest parsing (feature/hls)

There are a few manifest parsing events that are not logged in the console for the ext-x-stream-inf, the yellow blob of test cases at the bottom of the Sasi - 10/4/13 sheet should cover most of them.

Replay at the end of specific players has a small issue

Open the following player (posted at end)
Scroll video to just before the end and let it play to the end

Expected: video player resets video so that it can be replayed with one click
Actual: Player resets video, but is only replayed by clicking twice

(Note: player will show buffer image when scrubbed directly to the end at 46 secs)

Several negative hls cases cause the player to flat out break (feature/hls)

Start Socrates (make sure it is linked properly to video.js and video-js-swf)
Select any of the following test cases:

broken player in test cases:
renditions 400 error
ts request returns a server timeout
ts request returns a server error
segment request returns a server timeout
segment request returns a server error
highest/lowest rendition return a 404

Expected:
The player should break gracefully (or stay on a working renditon) when it breaks in these cases

Actual:
The player does not break gracefully

Note: Some of these cases need to be played to the buffer zone to see the break, any case that will involve switching to a broken rendition.

Update the video-js-swf owner and repo information

I found this while investigating a contribflow bug:
zencoder/contribflow#17

The contrib feature submit call failed because the video-js-swf owner and repo information were supplied as NONE:
user: NONE repo: NONE title: contrib-guide-update body: contrib-guide-update head: BCjwhisenant:feature/contrib-

We should make sure that the owner and repo information for video-js-swf are correct.

If it helps, here's my .git/config information:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = false
[remote "origin"]
        url = [email protected]:BCjwhisenant/video-js-swf.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[remote "upstream"]
        url = https://github.com/videojs/video-js-swf.git
        fetch = +refs/heads/*:refs/remotes/upstream/*
[branch "feature/contrib-guide-update"]
        remote = origin
        merge = refs/heads/feature/contrib-guide-update

Escape key fails to get the player out of fullscreen

Play a video on the player
Go into full screen
Scrub the player back to the start of the video
Try and get out of fullscreen by hitting the esc key while the video is still playing

Expected: video returns to its default web browser state and continues playing
Actual: video keeps playing in fullscreen

No error message is logged on a server timeout (feature/hls)

Start Socrates (make sure it is linked properly to video.js and video-js-swf)
Brightcove MBR, 16x9, 608k 1096k, 1096k returns a server timeout
Play video to the end of the first 3 TS segments
A rendition switch will then be attempted

Expected:
Error is logged, (playback should either stop or keep playing on current rendition)

Actual:
No timeout error is logged, playback stops, this keeps repeating in the console:
1381256759404 [undefined_component_3_flash_api] HLSVideoProvider: Buffer < 50%!1381256759406 [undefined_component_3_flash_api] ManifestManager.getNextData()1381256759408 [undefined_component_3_flash_api] ManifestManager.getNextData(): SegmentParser.parseSegmentBinaryData() for id: 01381256759409 [undefined_component_3_flash_api] Error #10091381256759410 [undefined_component_3_flash_api] ManifestManager.getNextData() - SegmentParser Error!

And playback eventually resumes.

loadedmetadata event fires whenever currentTime is 0

See videojs/video.js#462

http://jsfiddle.net/xu9Y6/10/ - (view in Firefox where flash player will be used)

I was able to find where the event is triggered, but I can't tell exactly how it's getting triggered.
https://github.com/videojs/video-js-swf/blob/master/src/com/videojs/providers/HTTPVideoProvider.as#L615

My best guess is this is a difference in how Flash works. That it always triggers the metadata event when you start from the beginning of a video file, even if you're just seeking back. Can anyone confirm?

Changing the source of a video does not remove the previous one leading to high CPU usage

If you change the src of a video the CPU usage grows fast with every src change. You can circumvent this by pausing the video, leading to issue #45.

var interval=2000;
var changeSrc=function(player, src) {
    setInterval(function() {
        player.src(src).play(); // no pause before playing the new one
    }, interval);
};
videojs("main_video", { "techOrder": ["flash", "html5"] }).ready(function () {
    changeSrc(this, 'http://vjs.zencdn.net/v/oceans.mp4');
});

Example (might slow down your PC): http://jsfiddle.net/fwcJh/35/

Rendition selection does not choose the best rendition for the current bandwidth on feature/hls

Set video-js-swf and video.js to their feature/hls branches.
Load the player through the server
Start up Charles and set throttling to 608kbs
Filter Charles to m3u8 and hit play, and then pause when video playback starts
The second m3u8 response will tell you what rendition url was chosen in the overview under URL, look at this and figure out what your current rendition selection is

Expected:
Rendition selection should choose 440kbs

Actual:
Rendition selection chooses 240kbs

Server 500/timeout errors keep playing video after rendition change till they hit their buffer zone (feature/hls)

Start Socrates (make sure it is linked properly to video.js and video-js-swf)
Brightcove MBR, 16x9, 608k 1096k, 1096k manifest request returns a server (error/timeout)
Play video to the end of the first 3 TS segments
A rendition switch will then be attempted

Expected:
Video recognizes the error, logs it to the console and (behavior has yet to have been decided)

Actual:
Video does not log the error, video plays to the the last segment loaded

Note: server error test case does log the error, but the spinner is overlain on the player after the rendition switch attempt.

Throttle bandwidth below the lowest rendition (feature/hls)

Start Socrates (make sure it is linked properly to video.js and video-js-swf)
Select 'Brightcove MBR, 16x9, 608k rendition' test case
Throttle bandwidth to 600kbs
Play video

Expected:
.... we have no clear expected at the moment

Actual:
The following error shows up in the console when playback starts, and the video has caught up with the buffer zone:

1380897257381 [undefined_component_3_flash_api] ManifestManager.getNextData()index....dlebars1380897257402 [undefined_component_3_flash_api] ManifestManager.getNextData(): SegmentParser.parseSegmentBinaryData() for id: 4index....dlebars1380897257415 [undefined_component_3_flash_api] Error #1009index....dlebars1380897257436 [undefined_component_3_flash_api] ManifestManager.getNextData() - SegmentParser Error!

Rotate the video

Is that possible to rotate the video in the player?

Just to give a background, why it would be handy.
I have a video stream from android phone, which I want to display using video.
According to the documentation,
http://developer.android.com/reference/android/media/MediaRecorder.html

Sets the orientation hint for output video playback. ....
This method will not trigger the source video frame to rotate during video recording,
but to add a composition matrix
containing the rotation angle in the output video if the output format is 
OutputFormat.THREE_GPP or OutputFormat.MPEG_4 so that a video player 
can choose the proper orientation for playback. 

I have more simple task, because I know the orientation of the camera, and I just need to rotate the player accordingly. For HTML5 this is easily done using CSS, and I wonder if this possible to do in a flash player.

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.