{"id":13743525,"url":"https://github.com/AxisCommunications/locomote-video-player","last_synced_at":"2025-05-09T01:31:00.040Z","repository":{"id":17474643,"uuid":"20248879","full_name":"AxisCommunications/locomote-video-player","owner":"AxisCommunications","description":"Media Player in Adobe Flash with RTSP support. (THIS PROJECT IS NO LONGER MAINTAINED)","archived":true,"fork":false,"pushed_at":"2020-03-06T09:03:02.000Z","size":11746,"stargazers_count":133,"open_issues_count":0,"forks_count":78,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-04-23T00:05:08.199Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"ActionScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"rusty1s/mongoose-i18n-localize","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AxisCommunications.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-28T07:31:49.000Z","updated_at":"2024-11-04T22:16:55.000Z","dependencies_parsed_at":"2022-09-02T12:10:35.885Z","dependency_job_id":null,"html_url":"https://github.com/AxisCommunications/locomote-video-player","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxisCommunications%2Flocomote-video-player","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxisCommunications%2Flocomote-video-player/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxisCommunications%2Flocomote-video-player/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxisCommunications%2Flocomote-video-player/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AxisCommunications","download_url":"https://codeload.github.com/AxisCommunications/locomote-video-player/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253174240,"owners_count":21865837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T05:00:49.918Z","updated_at":"2025-05-09T01:30:59.374Z","avatar_url":"https://github.com/AxisCommunications.png","language":"ActionScript","funding_links":[],"categories":["Multimedia"],"sub_categories":["Media Player"],"readme":"# Locomote Video Player [![Build Status](https://travis-ci.org/AxisCommunications/locomote-video-player.svg?branch=master)](https://travis-ci.org/AxisCommunications/locomote-video-player) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/AxisCommunications/locomote-video-player?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n# END-OF-LIFE NOTICE\nAs [Adobe Flash is reaching its end-of-life](https://theblog.adobe.com/adobe-flash-update/) Axis Communications is no longer maintaining this project.\n\nFor native HTML5/JavaScript video streaming of Axis cameras, see https://github.com/AxisCommunications/media-stream-library-js instead.\n\n## Getting started\n\n### Installing Locomote\nInstall Locomote using [Bower](http://bower.io) with the following command:\n\n```\nbower install locomote\n```\n\nInstall Locomote using [npm](http://npmjs.com) with the following command:\n```\nnpm install locomote-video-player\n```\n\n### Running Locomote\n\nTo run Locomote in a web page, you need to host both the SWF (`Player.swf` in example below),\nand the JavaScript library (`locomote.min.js` in example below). Use a simple page like:\n\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eLocomote\u003c/title\u003e\n    \u003cstyle type=\"text/css\"\u003e\n      #player {\n        width: 320px;\n        height: 240px;\n      }\n    \u003c/style\u003e\n    \u003cscript src=\"locomote.min.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"http://code.jquery.com/jquery-2.1.1.min.js\"\u003e\u003c/script\u003e\n    \u003cscript type=\"text/javascript\"\u003e\n\n      $(document).ready(function() {\n        /* Load SWF and instantiate Locomote */\n        var locomote = new Locomote('player', 'Player.swf');\n\n        /* Set up a listener for when the API is ready to be used */\n        locomote.on('apiReady', function() {\n          console.log('API is ready. `play` can now be called');\n\n          /* Tell Locomote to play the specified media */\n          locomote.play('rtsp://server.com/stream');\n        });\n\n        /* Start listening for streamStarted event */\n        locomote.on('streamStarted', function() {\n          console.log('stream has started');\n        });\n\n        /* If any error occurs, we should take action */\n        locomote.on('error', function(err) {\n          console.log(err);\n        });\n      });\n\n    \u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cdiv id=\"player\" class=\"player\"\u003e\u003c/div\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n### Socket Policy Server\n\n`Locomote` uses sockets to connect to RTSP video streams which requires a socket policy server to be implemented. For RTMP and HTTP streams no socket policy server is required.\n\nFlash Player 9 and above implements a strict access policy for Flash applications that make Socket or XMLSocket connections to a remote host. It now requires the presence of a socket policy file on the server.\n\nWhen the Flash Player tries to make a connection, it checks in two places for the socket policy:\n\n- Port 843. If you are the administrator of a server, you can set up an application to listen on this port and return a server-wide socket policy.\n- The destination port. If you're running your own xml server, you can configure it to send the socket policy file.\n\nThe Flash player always tries port 843 first; if there's no response after 3 seconds, then it tries the destination port.\n\nWhen the Flash player makes a connection, it sends the following XML string to the server:\n\n```\n\u003cpolicy-file-request/\u003e\n```\n\nYour server then must send the following XML in reply:\n\n```\n\u003ccross-domain-policy\u003e\n     \u003callow-access-from domain=\"*\" to-ports=\"*\" /\u003e\n\u003c/cross-domain-policy\u003e\n```\n\n`*` is the wildcard and means \"all ports/domains\". If you want to restrict access to a particular port, enter the port number, or a list or range of numbers.\n\nFor more info about socket policy files and how to set up a server please read the following articles:\n\n[Setting up a socket policy file server][SocketPolicySetup]\n\n[Policy file changes in Flash Player 9 and Flash Player 10][SocketPolicyChanges]\n\n## API Specification\n\n### Construction / Destruction\n\n#### Locomote(element, url)\n\n\u003e Locomote player constructor. Will load the Locomote SWF and embed the Locomote player in a DOM element.\n\n\u003e First argument is either an ID to an element in the DOM as a string or a reference to a DOM element. This is where Locomote will embed the player.\n\n\u003e The second argument is the URL to the player SWF.\n\n\u003e The player will load asynchronously. When the player is loaded an `apiReady` event is sent. Before the `apiReady` event, no API methods can be used except `on` and `off`.\n\n#### destroy()\n\n\u003e Will remove the tag from the element is was embedded to and remove all references\n\u003e to it held by the javascript library. This can be called as any other action. E.g.\n\u003e\n```javascript\nvar locomote = new Locomote('player', 'Player.swf');\nlocomote.destroy();\n```\n\n### Actions\n\n#### play(url:String, [options:Object])\n\n\u003e Starts playing video from url. Protocol is determined by url.\n\u003e Example: `rtsp://server:port/stream`.\n\u003e\n\u003e Supported protocols:\n\u003e\n\u003e - `rtsp` - [RTSP over TCP][RTSP/TCP]\n\u003e - `rtsph` - [RTSP over HTTP][RTSP/HTTP]\n\u003e - `rtsphs` - [RTSP over HTTPS][RTSP/HTTP]\n\u003e - `rtsphap` - RTSP over HTTPS via Axis Proxy\n\u003e - `rtmp` - [RTMP][RTMP]\n\u003e - `rtmpt` - RTMP over HTTP\n\u003e - `rtmps` - RTMP over SSL\n\u003e - `http` - Progressive download via HTTP\n\u003e - `https` - Progressive download via HTTP over SSL\n\u003e - `httpm` - [MJPEG over HTTP][MJPEG/HTTP] (via multipart/x-mixed-replace)\n\n\u003e `options` is an optional object with the following attributes:\n\u003e - `offset` - The offset to start the stream at. This is only supported by the\n    `rtsp[h|hs|hap]` protocol and requires the RTSP server to respect the range\n    header in the play request.\n\u003e - `httpUrl` - The URL to use in HTTP requests if it differs from the RTSP\n    URL. This is only supported by the `rtsp[h|hs]` (Note: not supported by `rtsphap`) protocol\n\n#### stop()\n\n\u003e Stops video stream.\n\n#### seek(offset)\n\n\u003e Seeks to the position specified by `offset` (calculated from the start of stream).\n\u003e\n\u003e If the currently player stream is RTMP, it may not work with seeking if the stream is live. Even if the material played is recorded\n\u003e it may not work depending on RTMP server implementation.\n\u003e In the RTMP case, this is really just delegated to [the implementation in the NetStream class][NetStream:seek].\n\u003e\n\u003e This does not work for RTSP at all (yet).\n\n#### pause()\n\n\u003e Pauses video stream.\n\n#### resume()\n\n\u003e Resumes video from paused state.\n\n#### playFrames(timestamp)\n\n\u003e Appends all received frames up to and including the given timestamp to the\n  play buffer. Only applicable if player is configured with `frameByFrame`.\n\n#### streamStatus()\n\n\u003e Returns a status object with the following data (if an entry is unknown, that value will be null):\n\n\u003e - fps - frames per second.\n\u003e - resolution (object) - the stream size `{ width, height }`.\n\u003e - playbackSpeed - current playback speed. 1.0 is normal stream speed.\n\u003e - current time - ms from start of stream.\n\u003e - protocol - which high-level transport protocol is in use.\n\u003e - state - current playback state (playing, paused, stopped).\n\u003e - streamURL - the source of the current media.\n\u003e - duration - the duration of the currently playing media, or -1 if not available\n\n#### playerStatus()\n\n\u003e Returns a status object with the following data:\n\n\u003e - buffer - The length of the buffer in seconds.\n\u003e - microphoneVolume - the volume of the microphone when capturing audio\n\u003e - speakerVolume - the volume of the speakers (i.e. the stream volume).\n\u003e - microphoneMuted (bool) - if the microphone is muted.\n\u003e - speakerMuted (bool) - if the speakers are muted.\n\u003e - fullScreen (bool) - if the player is currently in fullscreen mode.\n\u003e - version - the Locomote version number.\n\n#### speakerVolume(vol)\n\n\u003e Sets speaker volume from 0-100. The default value is 50.\n\n#### muteSpeaker()\n\n\u003e Mutes the speaker volume. Remembers the current volume and resets to it if the\n  speakers are unmuted.\n\n#### unmuteSpeaker()\n\n\u003e Resets the volume to previous unmuted value.\n\n#### microphoneVolume(vol)\n\n\u003e Sets microphone volume from 0-100. The default value is 50.\n\n#### muteMicrophone()\n\n\u003e Mutes the microphone. Remembers the current volume and resets to it if the\n  microphone is unmuted.\n\n#### unmuteMicrophone()\n\n\u003e Resets the volume to previous unmuted value.\n\n#### startAudioTransmit(url, type)\n\n\u003e Starts transmitting microphone input to the camera speaker.\n  The optional `type` parameter can be used for future implementations of other protocols,\n  currently only the Axis audio transmit api is supported.\n  For Axis cameras the `url` parameter should be in the format - `http://server:port/axis-cgi/audio/transmit.cgi`.\n\n\u003e If the user must grant permission to use the microphone an\n  `audioTransmitRequestPermission` event will be dispatched and\n  `startAudioTransmit` must be called again once permission has been granted.\n\n#### stopAudioTransmit()\n\n\u003e Stops transmitting microphone input to the camera speaker.\n\n#### config(config)\n\n\u003e Sets configuration values of the player. `config` is a JavaScript object that can have the following optional values:\n\n\u003e - `buffer` - The number of seconds that should be buffered. The default value is `3`.\n\u003e - `connectionTimeout` - The number of seconds before a broken connection times out and is closed. The default value is `10`.\n\u003e - `keepAlive` - The number of seconds between keep alive requests (only RTSP at the moment). The default value is `0` (disabled).\n\u003e - `scaleUp` - Specifies if the video can be scaled up or not. The default value is `false`.\n\u003e - `allowFullscreen` - Specifices if fullscreen mode is allowed or not. The default value is `true`.\n\u003e - `debugLogger` - Specifices if debug messages should be shown in the Flash console or not. The default value is `false`.\n\u003e - `frameByFrame` - Specifices if media should be played immediately or wait\n                     for calls to `playFrames`. Not supported by the `rtmp` protocol. The\n                     default value is `false`. The http and https protocol\n                     implements this by creating virtual frames, a timestamp\n                     given in the `frameReady` event may not correspond to a\n                     real video frame, and the player may play up to 50 ms more\n                     than the last `playFrames` call specified. The\n                     `rtsp[h|hs|hap]` protocol dispatches the `frameReady` event\n                     for each assembled FLV tag, if audio and video is received\n                     out of order this will cause `frameReady` events to be\n                     dispatched out of order.\n\n#### on(eventName:String, callback:Function)\n\n\u003e Starts listening for events with `eventName`. Calls `callback` when event triggers.\n\n#### off(eventName:String, callback:Function)\n\n\u003e Stops listening for events with eventName.\n\n### Events\n\n#### apiReady\n\n\u003e Dispatched when the player is fully initialized. This is always the first event to be sent. Before the `apiReady` event no API methods can be called except `on` and `off`.\n\n#### streamStarted\n\n\u003e Dispatched when video streams starts.\n\n#### streamPaused(result)\n\n\u003e Dispatched when video stream is paused. `result` is an object with a single property `reason` that can have the following values:\n\n\u003e - `user` - stream was paused by user.\n\u003e - `buffering` - stream has stopped for buffering.\n\n#### streamStopped\n\n\u003e Dispatched when stream stops.\n\n#### frameReady(timestamp)\n\n\u003e Dispatched when a new frame, or pseudo-frame, is available to be appended to\n  the play buffer. The timestamp of the frame is given by the argument. Append\n  it using the `playFrames` method. This event will only be dispatched if the\n  player is configured with the `frameByFrame` option. Otherwise, all frames\n  will be appended to the play buffer immediately when received and this event\n  will not be dispatched.\n\n#### error(error)\n\n\u003e Dispatched when video stream fails. `error` can be either\n\u003e protocol error (rtsp etc) or Locomote internal error.\n\u003e `error` is a generic object.\n\n\u003e Locomote reports the following types of errors:\n\u003e - `RTSP` - The default error codes that are sent from the RTSP stream. Error codes: 100 - 551.\n\u003e - `Flash Player` - Errors that are reported by Flash Socket, NetStream and NetConnection classes. Error codes: 700 - 799.\n\u003e - `Locomote` - Errors generated by the Locomote player. Error codes: 800 - 899.\n\n\u003e For detailed information about the errors, please see the\n[ErrorManager][ErrorManager] class.\n\n#### audioTransmitStarted\n\n\u003e Dispatched when audio transmission starts.\n\n#### audioTransmitStopped\n\n\u003e Dispatched when audio transmission stops.\n\n#### audioTransmitRequestPermission\n\n\u003e Dispatched when flash is prompting the user to grant or deny access to the\n  microphone. When this event is dispatched the setup is aborted and\n  `startAudioTransmit` must be called again after the event\n  `audioTransmitAllowed` has been dispatched.\n\n#### audioTransmitAllowed\n\n\u003e Dispatched when user has granted permission to use the microphone. A new call\n  to `startAudioTransmit` must be made to initiate audio transmission.\n\n#### audioTransmitDenied\n\n\u003e Dispatched when user has denied permission to use the microphone. If this\n  event is fired, any future calls to `startAudioTransmit` will generate an\n  error (816).\n\n#### fullscreenEntered\n\n\u003e Dispatched when the player enters fullscreen mode.\n\n#### fullscreenExited\n\n\u003e Dispatched when the player exits fullscreen mode.\n\n#### log\n\n\u003e Dispatched when a log message is sent from the player.\n\n## Building Locomote\n\n### Building with npm\n\nTo compile the project, [nodejs](http://www.nodejs.org) and [npm](http://www.npmjs.org) is required.\nSince `npm` is bundled with `nodejs`, you only need to download and install `nodejs`.\n\nTo build `Locomote`, simply run `npm install` followed by `gulp` in the root directory.\nThis will download [Adobe Flex SDK](http://www.adobe.com/devnet/flex/flex-sdk-download.html),\nand other required modules and build the `SWF` file and the `JavaScript` library to `dist/`.\n\n### Building with Flash Builder\n\nIt's also possible to build Locomote with Flash Builder. Follow the steps below to set up a Flash Builder project.\n\n- Clone the Locomote repository from Github.\n- Build the project with `npm` as described above. This will build as3corelib and the VERSION file which are both required dependencies.\n- Create a new ActionScript project from Flash Builder and save it in the root folder of the cloned repository.\n- Inside Flash Builder, right click the `Player.as` file that is now in the `default package` and select \"Set as Default Application\".\n- Remove the `.as` file with the same name you used for the project that was automatically created in `default package`.\n- Add as3corelib to the project by selecting \"Properties\" in the \"Project menu\" and then \"ActionScript Build Path\". Click \"Add SWC...\" and add as3corelib which is located here: `/ext/as3corelib/bin/as3corelib.swc`. Make sure that the library is merged into the code. Please note that the as3corelib.swc file will only be available after you have built the project with `npm`.\n- You may need to change the path to the default HTML file in \"Run/Debug Settings\". Edit the `Player` launch configuration and make sure that the correct url to the HTML file is selected.\n- The project can now be built by Flash Builder. Please note that you also need to modify the default HTML template provided with the Flash Builder project to load the swf and Javascript file properly. An example of a minimal HTML file is provided below.\n\nThe Flash Builder project files and build folders will be ignored by git automatically so you shouldn't have to add anything to the repository after setting up the project.\n\n[SocketPolicySetup]: http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html\n[SocketPolicyChanges]: http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html\n[RTSP/TCP]: http://www.ietf.org/rfc/rfc2326.txt\n[RTSP/HTTP]: http://www.opensource.apple.com/source/QuickTimeStreamingServer/QuickTimeStreamingServer-412.42/Documentation/RTSP_Over_HTTP.pdf\n[RTMP]: http://www.adobe.com/devnet/rtmp.html\n[ErrorManager]: https://github.com/AxisCommunications/locomote-video-player/blob/master/src/com/axis/ErrorManager.as\n[NetStream:seek]: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#seek()\n[MJPEG/HTTP]: http://en.wikipedia.org/wiki/Motion_JPEG#M-JPEG_over_HTTP\n\n## License\n\nThis project is licensed under the [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause).\nSee [LICENSE](https://github.com/AxisCommunications/locomote-video-player/blob/master/LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAxisCommunications%2Flocomote-video-player","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAxisCommunications%2Flocomote-video-player","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAxisCommunications%2Flocomote-video-player/lists"}