Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
vue-media-annotator
Advanced tools
This directory contains the code for:
vue-media-annotator
Requires Node 16 due to this webpack issue and the fact that we are on vue cli service v4. Should be resolved by upgrading to v5, which is not yet released.
# install dependencies
yarn
# run development server
yarn serve
# build for production
yarn build:web
# build vue-media-server library
yarn build:lib
# Electron
yarn serve:electron
yarn build:electron
# lint and test
yarn lint
yarn lint:templates
yarn test
# Local verification of all tests, linting, builds
./checkbuild.sh
# Build
yarn build:cli
# Watch (requires above build at least once)
yarn dev:cli
# Run in development mode
yarn divecli --help
# Parse VIAME CSV
yarn divecli viame2json /path/to/viame.csv
# Parse DIVE JSON
yarn divecli json2viame /path/to/results.json /path/to/meta.json
# output to file, suppress yarn's stdout
yarn --silent divecli viame2json /path/to/viame.csv > tracks.json
Configuration abnormalities:
Note tsconfig.cli.json is used to build the cli. It's necessary to specify the exact files along the import path of the cli.js entrypoint, and if new files are added, they will need to be added manually. Build errors should alert you to this.
tsconfig.json
: { target: 'es2018' }
used because renderer/web uses babel but background does not, and webpack doesn't support esnextCreate a new release tagged X.X.X
through github.
The client is broken into 4 main folders which separate different parts of the system.
/dive-common
/platform/web-girder
/platform/desktop
/platform/desktop/backend/server.ts
/platform/desktop/backend/native/
/platform/desktop/backend/serializers
To resuse as much code as possible between the Desktop and Web versions there is a unified API which provides the capability to export/import/save/delete annotations and metadata as well as run training and configuration pipelines. This API allows both versions to share the /dive-common
and /src
folders while handling these calls differently.
./platform/desktop/frontend/components/ViewerLoader.vue
or `./platform/web-girder/views/ViewerLoader.vue./dive-common/components/Viewer.vue
provideAnnotator
for use in other componentsuseSave
useSave
has arguments which include the current datasetId and the readonlyState.import { useselectedTrackId } from ‘vue-media-annotator/provides’
to use a reactive property of the selected trackId.Use ES6 classes to implement stateful modules that form the core of the application. We previously used composition functions, but these became unweildy as more state needed to be pushed through the src/provides.ts
interface. Classes like TrackStore.ts
can encapsulate related states and functions, and we can make use of traditional inheritance design patterns like base classes.
These components form the base of an annotator instance. The root display for Media (Images or Video) are located in this folder. They construct the geojs instance and maintain state. State is shared with layers through a special provide/inject mechanism. The annotator API is documented in src/components/annotators/README.md
$emit
.provide()
function is used because the special instance is tied to its parent's lifecycle and cannot be hoisted.useMediaController: allows for synchronizing the state among multiple cameras in multi-cam mode as well as allowing the other components to view/set the current frame or playback.
These layers are provided to an annotator as slots and can inject their parent annotator state. Generally, a layer will set up a watcher on that state and update their own GeoJS features based on that. These watchers may run at up to 60hz so performance considerations matter.
This application has many layers that interact, requiring a manager src/components/LayerManager.vue
.
EditAnnotationLayer.ts
Editing and Creation of all annotation types is handled in EditAnnotationLayer.ts
. The EditAnnotationLayer bubbles up edits to the LayerManager which through provides
will pass the editing to useModeManager
. useModeManager
will make decisions about how to update the state of DIVE as well as updating the annotation data in the trackStore
Annotation Editing Flow:
Layer manager uses the /src/provides.ts
to view the current frame and tracks that should be visible for the frame and draw them on the screen. The function updateLayers
is connected to a watcher which watches for changes in frame, selectedTrack, the visiblity of tracks provided, and Annotator preferences (visibility of certain annotation types or track tail length).
Controllers are like layers, but without geojs functionality. They usually provide some UI wigetry to manipulate the annotator state (such as playblack position or playpause state). The timeline representation of tracks for graphing is located in the constrols as well.
Provides a common, typed interface for components and composition functions to access singleton state like trackStore
, selectedTrackId
, and many others.
This pattern has similar trade-offs to Vuex; It makes component re-use with different state more difficult. The provide/inject style using typed functions provides similar type safety and DRY advantages while allowing downstream library consumers to wrap and customize state, such as with chained computed properties.
/* Example consumer */
provide(...state); // downstream provides a collection of refs and other state expected by the library.
/* Example librarty component */
import { useSelectedTrackId } from 'vue-media-annotator/provides';
const selectedTrackIdRef = useSelectedTrackId();
This style guarantees matching types are passed through provide and inject without having to replicate the type definition through possibly many layers of props:{}
type definitions, and automatically wraps with readonly
to prevent short-circut updates.
The use{x} files in this folder pertain directly to media or annotation information. These objects will be used in provides.ts
so that other components can access and manipulate the data.
useEventChart
and useLineChart
take the visible tracks and format the data for drawing in swimlane or line graph formats
useAttributes
provide a reactive list of templates to show the attributes to the user. Attribute Filters and generation of Attribute Graphs are also configured and retrieved through useAttributes
. Attributes that don't have a template defined in the metadata will not be shown to the user. On import the backend (both web and desktop) will attempt to auto generate these attribute templates based on the values provided.
The DIVE interfaces handles the loading of data in Viewer.vue and manages the layout of components provided in /src
and the state managment of the system through useModeManager
useModeManager.ts is used to manage the current state and state transitions within the DIVE application (e.g.,
transitioning between selected, editing, deletion, modification, etc.). Most interactions that operate on the annotation data are coordinated through useModeManager.
Many of the functions and reactive properties are sent to ./src/provides.ts
to allow components to view and manipulate the current state.
Recipes (./dive-common/recipes/
) allow for custom workflows when creating annotations.
Note that tsconfig.spec.json
is an exact copy of tsconfig.json
but the target
and module
are changed such that babel is not required for jest to execute tests.
Parts of the annotator in src/
can be included from an external annotator library. Requires @vue/composition-api
.
npm install vue-media-annotator
Now include the parts you want.
import {
providers,
use,
Track,
components,
} from 'vue-media-annotator/lib';
const {
VideoAnnotator, LayerManager, Controls, Timeline, LineChart,
} = components;
Note that you must abandon
vuetify-loader
in order to use this lib. It relies on vuetify's components to be registered with the global context, which doesn't happen with an a-la-carte installation.
Note you can clone this repo, use
yarn link
, andyarn link vue-media-annotator
in your own project to modify the source library as you go. You'll have toyarn build:lib
after changes, and you mustmv node_modeles/ node_modules.old/
in order to prevent your consumer app from using this project'snode_modules
libs instead of yours. This could cause problems like multiple instances of vue or composition api.
The above problems are known and we are working to solve them.
FAQs
DIVE annotation platform
The npm package vue-media-annotator receives a total of 1 weekly downloads. As such, vue-media-annotator popularity was classified as not popular.
We found that vue-media-annotator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.