Skip to content

Commit f877a96

Browse files
committed
update to videojs-swf 4.4.2 to be compatible with videojs 4.6.x
support live badge on UI
1 parent a1d3c08 commit f877a96

16 files changed

+244
-76
lines changed

.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@ bin-debug
55
http/node_modules
66
node_modules
77
dist/*
8-
build
8+
build
9+
10+
*.orig
11+
12+
sandbox/*
13+
!sandbox/*.example

.npmignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# .npmignore needed so dist dir won't be ignored
2-
# https://npmjs.org/doc/developers.html#Keeping-files-out-of-your-package
1+
# Exclude everything but the contents of the dist directory.
2+
**/*
3+
!dist/**

CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
CHANGELOG
2+
=========
3+
4+
## HEAD (Unreleased)
5+
_(none)_
6+
7+
--------------------
8+
9+
## 4.4.2 (2014-07-11)
10+
* Fixed networkState reporting to be more accurate after loadstart ([view](https://github.com/videojs/video-js-swf/pull/106))
11+
12+
## 4.4.1 (2014-06-11)
13+
* Ignore unnecessary files from npm packaging ([view](https://github.com/videojs/video-js-swf/pull/87))
14+
* Fixed bug triggering `playing` ([view](https://github.com/videojs/video-js-swf/pull/90))
15+
* Fixed bug with the timing of `loadstart` ([view](https://github.com/videojs/video-js-swf/pull/93))
16+
* Added support for clearing the NetStream while in Data Generation Mode ([view](https://github.com/videojs/video-js-swf/pull/93))
17+
* Fixed silent exception when opening MediaSources ([view](https://github.com/videojs/video-js-swf/pull/97))
18+
19+
## 4.4.0 (2014-02-18)
20+
* Added changelog
21+
* Added support for using NetStream in Data Generation Mode ([view](https://github.com/videojs/video-js-swf/pull/80))
22+
* Extended base support for external appendData for integration with HLS / Media Source plugins ([view](https://github.com/videojs/video-js-swf/pull/80))
23+
* Fixed bug with viewport sizing on videos which don't present meta data ([view](https://github.com/videojs/video-js-swf/pull/80))
24+
* Fixed bugs with buffered and duration reporting on non-linear streams ([view](https://github.com/videojs/video-js-swf/pull/80))
25+
* Added refined seeking for use on non-linear streams ([view](https://github.com/videojs/video-js-swf/pull/80))
26+
* Extended endOfStream for use with Media Sources API ([view](https://github.com/videojs/video-js-swf/pull/80))
27+

Gruntfile.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ module.exports = function (grunt) {
171171
grunt.loadNpmTasks('grunt-npm');
172172
grunt.loadNpmTasks('grunt-shell');
173173
grunt.loadNpmTasks('grunt-prompt');
174+
grunt.loadNpmTasks('chg');
174175

175176
grunt.registerTask('dist', ['mxmlc']);
176177
grunt.registerTask('default', ['dist']);
@@ -277,16 +278,17 @@ module.exports = function (grunt) {
277278
'shell:git-diff-exit-code', // ensure there's no unadded changes
278279
'shell:git-diff-cached-exit-code', // ensure there's no added changes
279280
'shell:git-checkout-stable', // must start on the stable branch
281+
'chg-release:'+type, // add release to changelog
280282
'bumpup:'+type, // bump up the package version
281283
'dist', // build distribution
282284
'shell:git-add-dist-force', // force add the distribution
283285
'tagrelease', // commit & tag the changes
284-
'shell:git-push-stable',
285-
'shell:git-push-tags',
286-
'npm-publish',
287-
'shell:git-checkout-master',
288-
'shell:git-merge-stable',
289-
'shell:git-push-master'
286+
'shell:git-push-stable', // push changes to stable
287+
'shell:git-push-tags', // push version tag
288+
'npm-publish', // publish to npm
289+
'shell:git-checkout-master', // switch to master branch
290+
'shell:git-merge-stable', // merge stable into master
291+
'shell:git-push-master' // push changes to master
290292
]);
291293
});
292294

README.md

+3-17
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,34 @@ Installation
66
============
77

88
1. Install Node Packages.
9-
109
```bash
1110
npm install
1211
```
13-
1412
2. Compile SWF.
15-
1613
Development (places new SWF in /dist/):
17-
1814
```bash
1915
grunt mxmlc
2016
```
21-
2217
Production/ Distribution (runs mxmlc task and copies SWF to dist/):
23-
2418
```bash
2519
grunt dist
2620
```
27-
2821
3. Run Connect Server.
29-
3022
```bash
3123
grunt connect:dev
3224
```
33-
34-
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.
25+
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.
3526

3627

3728
Running Unit and Integration Tests
3829
===========
3930

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

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

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

46-
In order to run all of the tests, run test.sh.
47-
48-
./test.sh
49-
50-
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.
37+
In order to run all of the tests, use the links at [http://localhost:8000/index.html](http://localhost:8000/index.html)
5138

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

dist/video-js.swf

487 Bytes
Binary file not shown.

index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<a href="tests/test.html">Automated Tests</a><br>
21
<a href="tests/manual/index.html">Manual Tests</a><br>
3-
<a href="sandbox/">Sandbox (all files in this directory will be ignored)</a><br>
2+
<a href="tests/test.html">Automated Tests (needs some work to use without local changes)</a><br>
3+
<a href="sandbox/">Sandbox (all files in this directory will be ignored)</a> <br>

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "videojs-swf",
33
"description": "The Flash-fallback video player for video.js (http://videojs.com)",
4-
"version": "4.3.5",
4+
"version": "4.4.2",
55
"copyright": "Copyright 2014 Brightcove, Inc. https://github.com/videojs/video-js-swf/blob/master/LICENSE",
66
"keywords": [
77
"flash",
@@ -16,8 +16,8 @@
1616
},
1717
"devDependencies": {
1818
"async": "~0.2.9",
19-
"flex-sdk": "4.6.0",
20-
"video.js": "4.3.0",
19+
"flex-sdk": "4.6.0-0",
20+
"video.js": "^4.6.0",
2121
"grunt-cli": "~0.1.0",
2222
"grunt": "~0.4.0",
2323
"grunt-connect": "~0.2.0",
@@ -29,6 +29,7 @@
2929
"grunt-tagrelease": "~0.3.1",
3030
"grunt-shell": "~0.6.1",
3131
"grunt-prompt": "~0.1.2",
32-
"grunt-npm": "~0.0.2"
32+
"grunt-npm": "~0.0.2",
33+
"chg": "~0.1.5"
3334
}
3435
}

sandbox/videojs.html.example

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
<title>Video.js | HTML5 Video Player</title>
55

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

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

1616
</head>

src/VideoJS.as

+15-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ package{
6969
try{
7070
ExternalInterface.addCallback("vjs_appendBuffer", onAppendBufferCalled);
7171
ExternalInterface.addCallback("vjs_echo", onEchoCalled);
72+
ExternalInterface.addCallback("vjs_endOfStream", onEndOfStreamCalled);
73+
ExternalInterface.addCallback("vjs_abort", onAbortCalled);
74+
7275
ExternalInterface.addCallback("vjs_getProperty", onGetPropertyCalled);
7376
ExternalInterface.addCallback("vjs_setProperty", onSetPropertyCalled);
7477
ExternalInterface.addCallback("vjs_autoplay", onAutoplayCalled);
@@ -185,6 +188,14 @@ package{
185188
private function onEchoCalled(pResponse:* = null):*{
186189
return pResponse;
187190
}
191+
192+
private function onEndOfStreamCalled():*{
193+
_app.model.endOfStream();
194+
}
195+
196+
private function onAbortCalled():*{
197+
_app.model.abort();
198+
}
188199

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

@@ -276,6 +287,9 @@ package{
276287

277288
private function onSetPropertyCalled(pPropertyName:String = "", pValue:* = null):void{
278289
switch(pPropertyName){
290+
case "duration":
291+
_app.model.duration = Number(pValue);
292+
break;
279293
case "mode":
280294
_app.model.mode = String(pValue);
281295
break;
@@ -335,7 +349,7 @@ package{
335349
}
336350

337351
private function openExternalMSObject(pSrc:*):void{
338-
ExternalInterface.call('videojs.MediaSource.open("' +pSrc+ '", "' +ExternalInterface.objectID+ '")');
352+
ExternalInterface.call('videojs.MediaSource.open', pSrc, ExternalInterface.objectID);
339353
}
340354

341355
private function onSrcCalled(pSrc:* = ""):void{

src/com/videojs/VideoJSModel.as

+14
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ package com.videojs{
106106
public function appendBuffer(bytes:ByteArray):void{
107107
_provider.appendBuffer(bytes);
108108
}
109+
110+
public function endOfStream():void {
111+
_provider.endOfStream();
112+
}
113+
114+
public function abort():void {
115+
_provider.abort();
116+
}
109117

110118
public function get backgroundColor():Number{
111119
return _backgroundColor;
@@ -168,6 +176,12 @@ package com.videojs{
168176
}
169177
return 0;
170178
}
179+
180+
public function set duration(value:Number):void {
181+
if(_provider && _provider is HTTPVideoProvider) {
182+
(_provider as HTTPVideoProvider).duration = value;
183+
}
184+
}
171185

172186
public function get autoplay():Boolean{
173187
return _autoplay;

src/com/videojs/providers/HLSProvider.as

+16-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ package com.videojs.providers{
1414

1515
import org.mangui.hls.HLS;
1616
import org.mangui.hls.HLSEvent;
17+
import org.mangui.hls.HLSTypes;
1718
import org.mangui.hls.HLSSettings;
1819
import org.mangui.hls.HLSPlayStates;
1920
import org.mangui.hls.utils.Log;
@@ -190,7 +191,11 @@ package com.videojs.providers{
190191
* Should return a value that indicates the current asset's duration, in seconds.
191192
*/
192193
public function get duration():Number {
193-
return _duration;
194+
if(_hls.type == HLSTypes.VOD) {
195+
return _duration;
196+
} else {
197+
return -1;
198+
}
194199
}
195200

196201
/**
@@ -449,5 +454,15 @@ package com.videojs.providers{
449454
_videoReference.clear();
450455
}
451456
}
457+
458+
459+
public function endOfStream():void{
460+
throw "HLSProvider does not support endOfStream";
461+
}
462+
463+
public function abort():void{
464+
throw "HLSProvider does not support abort";
465+
}
466+
452467
}
453468
}

src/com/videojs/providers/HTTPAudioProvider.as

+9-1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ package com.videojs.providers{
114114
public function appendBuffer(bytes:ByteArray):void{
115115
throw "HTTPAudioProvider does not support appendBuffer";
116116
}
117+
118+
public function endOfStream():void{
119+
throw "HTTPAudioProvider does not support endOfStream";
120+
}
121+
122+
public function abort():void{
123+
throw "HTTPAudioProvider does not support abort";
124+
}
117125

118126
public function get buffered():Number{
119127
if(duration > 0){
@@ -441,4 +449,4 @@ package com.videojs.providers{
441449
_model.broadcastEventExternally(ExternalEventName.ON_METADATA, _metadata);
442450
}
443451
}
444-
}
452+
}

0 commit comments

Comments
 (0)