In this paper, we propose a scheme to apply network coding to heterogeneous peer-to-peer media streaming systems. As most peers in a peer-to-peer media streaming system are individual computers connected to the Internet through access links with heterogeneous link capacities, it is desirable to design an adaptive scheme to make efficient use of the bandwidth of the access links. We propose an adaptive network coding scheme for heterogeneous peer-to-peer streaming systems. The media content is encoded into multiple stripes. The peers select one or more stripes to subscribe based on their own download bandwidths. For each stripe, a subgraph is constructed such that the coding probability is maximized. In addition, we propose an overlay topology construction algorithm which takes both upload bandwidth and download bandwidth into consideration. We compare our scheme with another recently proposed scheme called LION through simulations. Our simulation results show that the proposed scheme achieves higher satisfaction and better throughput than LION with or without churn.