Skip to content

Commit

Permalink
update to videojs-swf 4.4.2 to be compatible with videojs 4.6.x
Browse files Browse the repository at this point in the history
support live badge on UI
  • Loading branch information
mangui committed Jul 17, 2014
1 parent a1d3c08 commit f877a96
Show file tree
Hide file tree
Showing 16 changed files with 244 additions and 76 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ bin-debug
http/node_modules
node_modules
dist/*
build
build

*.orig

sandbox/*
!sandbox/*.example
5 changes: 3 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# .npmignore needed so dist dir won't be ignored
# https://npmjs.org/doc/developers.html#Keeping-files-out-of-your-package
# Exclude everything but the contents of the dist directory.
**/*
!dist/**
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
CHANGELOG
=========

## HEAD (Unreleased)
_(none)_

--------------------

## 4.4.2 (2014-07-11)
* Fixed networkState reporting to be more accurate after loadstart ([view](https://github.com/videojs/video-js-swf/pull/106))

## 4.4.1 (2014-06-11)
* Ignore unnecessary files from npm packaging ([view](https://github.com/videojs/video-js-swf/pull/87))
* Fixed bug triggering `playing` ([view](https://github.com/videojs/video-js-swf/pull/90))
* Fixed bug with the timing of `loadstart` ([view](https://github.com/videojs/video-js-swf/pull/93))
* Added support for clearing the NetStream while in Data Generation Mode ([view](https://github.com/videojs/video-js-swf/pull/93))
* Fixed silent exception when opening MediaSources ([view](https://github.com/videojs/video-js-swf/pull/97))

## 4.4.0 (2014-02-18)
* Added changelog
* Added support for using NetStream in Data Generation Mode ([view](https://github.com/videojs/video-js-swf/pull/80))
* Extended base support for external appendData for integration with HLS / Media Source plugins ([view](https://github.com/videojs/video-js-swf/pull/80))
* Fixed bug with viewport sizing on videos which don't present meta data ([view](https://github.com/videojs/video-js-swf/pull/80))
* Fixed bugs with buffered and duration reporting on non-linear streams ([view](https://github.com/videojs/video-js-swf/pull/80))
* Added refined seeking for use on non-linear streams ([view](https://github.com/videojs/video-js-swf/pull/80))
* Extended endOfStream for use with Media Sources API ([view](https://github.com/videojs/video-js-swf/pull/80))

14 changes: 8 additions & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-npm');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-prompt');
grunt.loadNpmTasks('chg');

grunt.registerTask('dist', ['mxmlc']);
grunt.registerTask('default', ['dist']);
Expand Down Expand Up @@ -277,16 +278,17 @@ module.exports = function (grunt) {
'shell:git-diff-exit-code', // ensure there's no unadded changes
'shell:git-diff-cached-exit-code', // ensure there's no added changes
'shell:git-checkout-stable', // must start on the stable branch
'chg-release:'+type, // add release to changelog
'bumpup:'+type, // bump up the package version
'dist', // build distribution
'shell:git-add-dist-force', // force add the distribution
'tagrelease', // commit & tag the changes
'shell:git-push-stable',
'shell:git-push-tags',
'npm-publish',
'shell:git-checkout-master',
'shell:git-merge-stable',
'shell:git-push-master'
'shell:git-push-stable', // push changes to stable
'shell:git-push-tags', // push version tag
'npm-publish', // publish to npm
'shell:git-checkout-master', // switch to master branch
'shell:git-merge-stable', // merge stable into master
'shell:git-push-master' // push changes to master
]);
});

Expand Down
20 changes: 3 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,34 @@ Installation
============

1. Install Node Packages.

```bash
npm install
```

2. Compile SWF.

Development (places new SWF in /dist/):

```bash
grunt mxmlc
```

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

```bash
grunt dist
```

3. Run Connect Server.

```bash
grunt connect:dev
```

8. Open your browser at [http://localhost:8000/index.html](http://localhost:8000/index.html) to see a video play. You can keep using grunt to rebuild the Flash code.
4. Open your browser at [http://localhost:8000/index.html](http://localhost:8000/index.html) to see a video play. You can keep using grunt to rebuild the Flash code.


Running Unit and Integration Tests
===========

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

For unit tests, this project uses [FlexUnit](http://flexunit.org/). The unit tests can be found in [project root]/src/com/videojs/test/

For integration tests, this project uses [qunit](http://qunitjs.com/). The integration tests can be found in [project root]/test

In order to run all of the tests, run test.sh.

./test.sh

A copy of the SWF produced for the unit tests will be compiled into the bin-debug folder. Both the unit and integration tests will attempt to run with the 'open' command, or an instruction will be given on how to run them manually.
In order to run all of the tests, use the links at [http://localhost:8000/index.html](http://localhost:8000/index.html)

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

Binary file modified dist/video-js.swf
Binary file not shown.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<a href="tests/test.html">Automated Tests</a><br>
<a href="tests/manual/index.html">Manual Tests</a><br>
<a href="sandbox/">Sandbox (all files in this directory will be ignored)</a><br>
<a href="tests/test.html">Automated Tests (needs some work to use without local changes)</a><br>
<a href="sandbox/">Sandbox (all files in this directory will be ignored)</a> <br>
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "videojs-swf",
"description": "The Flash-fallback video player for video.js (http://videojs.com)",
"version": "4.3.5",
"version": "4.4.2",
"copyright": "Copyright 2014 Brightcove, Inc. https://github.com/videojs/video-js-swf/blob/master/LICENSE",
"keywords": [
"flash",
Expand All @@ -16,8 +16,8 @@
},
"devDependencies": {
"async": "~0.2.9",
"flex-sdk": "4.6.0",
"video.js": "4.3.0",
"flex-sdk": "4.6.0-0",
"video.js": "^4.6.0",
"grunt-cli": "~0.1.0",
"grunt": "~0.4.0",
"grunt-connect": "~0.2.0",
Expand All @@ -29,6 +29,7 @@
"grunt-tagrelease": "~0.3.1",
"grunt-shell": "~0.6.1",
"grunt-prompt": "~0.1.2",
"grunt-npm": "~0.0.2"
"grunt-npm": "~0.0.2",
"chg": "~0.1.5"
}
}
6 changes: 3 additions & 3 deletions sandbox/videojs.html.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<title>Video.js | HTML5 Video Player</title>

<!-- Change URLs to wherever Video.js files will be hosted -->
<link href="node_modules/video.js/video-js.css" rel="stylesheet" type="text/css">
<link href="../node_modules/video.js/dist/video-js/video-js.css" rel="stylesheet" type="text/css">
<!-- video.js must be in the <head> for older IEs to work. -->
<script src="node_modules/video.js/video.js"></script>
<script src="../node_modules/video.js/dist/video-js/video.js"></script>

<!-- Unless using the CDN hosted version, update the URL to the Flash SWF -->
<script>
videojs.options.flash.swf = "dist/video-js.swf";
videojs.options.flash.swf = "../dist/video-js.swf";
</script>

</head>
Expand Down
16 changes: 15 additions & 1 deletion src/VideoJS.as
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ package{
try{
ExternalInterface.addCallback("vjs_appendBuffer", onAppendBufferCalled);
ExternalInterface.addCallback("vjs_echo", onEchoCalled);
ExternalInterface.addCallback("vjs_endOfStream", onEndOfStreamCalled);
ExternalInterface.addCallback("vjs_abort", onAbortCalled);

ExternalInterface.addCallback("vjs_getProperty", onGetPropertyCalled);
ExternalInterface.addCallback("vjs_setProperty", onSetPropertyCalled);
ExternalInterface.addCallback("vjs_autoplay", onAutoplayCalled);
Expand Down Expand Up @@ -185,6 +188,14 @@ package{
private function onEchoCalled(pResponse:* = null):*{
return pResponse;
}

private function onEndOfStreamCalled():*{
_app.model.endOfStream();
}

private function onAbortCalled():*{
_app.model.abort();
}

private function onGetPropertyCalled(pPropertyName:String = ""):*{

Expand Down Expand Up @@ -276,6 +287,9 @@ package{

private function onSetPropertyCalled(pPropertyName:String = "", pValue:* = null):void{
switch(pPropertyName){
case "duration":
_app.model.duration = Number(pValue);
break;
case "mode":
_app.model.mode = String(pValue);
break;
Expand Down Expand Up @@ -335,7 +349,7 @@ package{
}

private function openExternalMSObject(pSrc:*):void{
ExternalInterface.call('videojs.MediaSource.open("' +pSrc+ '", "' +ExternalInterface.objectID+ '")');
ExternalInterface.call('videojs.MediaSource.open', pSrc, ExternalInterface.objectID);
}

private function onSrcCalled(pSrc:* = ""):void{
Expand Down
14 changes: 14 additions & 0 deletions src/com/videojs/VideoJSModel.as
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ package com.videojs{
public function appendBuffer(bytes:ByteArray):void{
_provider.appendBuffer(bytes);
}

public function endOfStream():void {
_provider.endOfStream();
}

public function abort():void {
_provider.abort();
}

public function get backgroundColor():Number{
return _backgroundColor;
Expand Down Expand Up @@ -168,6 +176,12 @@ package com.videojs{
}
return 0;
}

public function set duration(value:Number):void {
if(_provider && _provider is HTTPVideoProvider) {
(_provider as HTTPVideoProvider).duration = value;
}
}

public function get autoplay():Boolean{
return _autoplay;
Expand Down
17 changes: 16 additions & 1 deletion src/com/videojs/providers/HLSProvider.as
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package com.videojs.providers{

import org.mangui.hls.HLS;
import org.mangui.hls.HLSEvent;
import org.mangui.hls.HLSTypes;
import org.mangui.hls.HLSSettings;
import org.mangui.hls.HLSPlayStates;
import org.mangui.hls.utils.Log;
Expand Down Expand Up @@ -190,7 +191,11 @@ package com.videojs.providers{
* Should return a value that indicates the current asset's duration, in seconds.
*/
public function get duration():Number {
return _duration;
if(_hls.type == HLSTypes.VOD) {
return _duration;
} else {
return -1;
}
}

/**
Expand Down Expand Up @@ -449,5 +454,15 @@ package com.videojs.providers{
_videoReference.clear();
}
}


public function endOfStream():void{
throw "HLSProvider does not support endOfStream";
}

public function abort():void{
throw "HLSProvider does not support abort";
}

}
}
10 changes: 9 additions & 1 deletion src/com/videojs/providers/HTTPAudioProvider.as
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ package com.videojs.providers{
public function appendBuffer(bytes:ByteArray):void{
throw "HTTPAudioProvider does not support appendBuffer";
}

public function endOfStream():void{
throw "HTTPAudioProvider does not support endOfStream";
}

public function abort():void{
throw "HTTPAudioProvider does not support abort";
}

public function get buffered():Number{
if(duration > 0){
Expand Down Expand Up @@ -441,4 +449,4 @@ package com.videojs.providers{
_model.broadcastEventExternally(ExternalEventName.ON_METADATA, _metadata);
}
}
}
}
Loading

0 comments on commit f877a96

Please sign in to comment.