In this review we address the dynamics of relativistic heavy-ion reactions and in particular the information obtained from electromagnetic probes that stem from the partonic and hadronic phases. The out-of-equilibrium description of strongly interacting relativistic fields is based on the theory of Kadanoff and Baym. For the modeling of the partonic phase we introduce a dynamical quasiparticle model (DQPM) for QCD in equilibrium. The widths and masses of the quasiparticles are controlled by transport coefficients in comparison to lattice QCD results. The resulting off-shell transport approach - denoted by Parton-Hadron-String Dynamics (PHSD) - also includes covariant dynamical hadronization and keeps track of the hadronic interactions in the final phase. We show that PHSD captures the bulk dynamics of heavy-ion collisions from SPS to LHC energies and provides a basis for the evaluation of the electromagnetic emissivity, using the same dynamical parton propagators as for the system evolution. Direct photon production in elementary processes and heavy-ion reactions at RHIC and LHC energies is investigated and the status of the photon v2 puzzle - a large elliptic flow of the direct photons observed in A+A collisions - is addressed. We discuss the roles of hadronic and partonic sources for the photon spectra and the flow coefficients v2 and v3 and also the possibility to subtract the QGP signal from observables. Furthermore, the production of dilepton pairs is addressed from SIS to LHC energies. The low-mass dilepton yield is enhanced due to the in-medium modification of the rho-meson and at the lowest energy also due to a multiple regeneration of Delta-resonances. In addition, a signal of the partonic degrees-of-freedom is found in the intermediate dilepton mass regime (1.2GeV<M<3GeV), which can shed light on the nature of the very early degrees-of-freedom in nucleus-nucleus collisions.