Skip to content
This repository has been archived by the owner on Dec 10, 2020. It is now read-only.

Commit

Permalink
appendChunkReady (#218)
Browse files Browse the repository at this point in the history
* Use an alternative method of passing data to the swf by adding a method that takes a javascript function name for the swf to call through ExternalInterface
  • Loading branch information
mjneil authored Feb 2, 2017
1 parent 8e55ad1 commit 117fcb4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Binary file modified dist/video-js.swf
Binary file not shown.
9 changes: 8 additions & 1 deletion src/VideoJS.as
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ package{
}

private function registerExternalMethods():void{

ExternalInterface.marshallExceptions = true;
try{
ExternalInterface.addCallback("vjs_appendBuffer", onAppendBufferCalled);
ExternalInterface.addCallback("vjs_appendChunkReady", onAppendChunkReadyCalled);
ExternalInterface.addCallback("vjs_echo", onEchoCalled);
ExternalInterface.addCallback("vjs_endOfStream", onEndOfStreamCalled);
ExternalInterface.addCallback("vjs_abort", onAbortCalled);
Expand Down Expand Up @@ -193,6 +194,12 @@ package{

private function onAppendBufferCalled(base64str:String):void{
var bytes:ByteArray = Base64.decode(base64str);
// write the bytes to the provider
_app.model.appendBuffer(bytes);
}

private function onAppendChunkReadyCalled(fnName:String):void{
var bytes:ByteArray = Base64.decode(ExternalInterface.call(fnName));

// write the bytes to the provider
_app.model.appendBuffer(bytes);
Expand Down

0 comments on commit 117fcb4

Please # to comment.