This research designed an improved collaborative filtering algorithm to be responsible for music recommendation tasks in the online music teaching platform. This algorithm integrates the user's social trust into the similarity calculation formula. Then, the algorithm uses behavioral feature data driven by preferences, music tags, and popularity as the basis for recommendation calculation. It adopts user data testing on an online music teaching platform. The results showed that when the number of recommended music was eight, the recommended recall rates of XCF, CTR, TSR, and UB-CF recommendation models reached their maximum, reaching 97.82%, 95.26%, 93.95%, and 88.72%, respectively. The AUC and average computational time of the ROC curves for XCF, CTR, TSR, and UB-CF recommended models are 0.7, 0.68, 0.64, 0.57, and 160ms, 136ms, 114ms, and 88ms, respectively. The experimental data shows that the recommendation accuracy of the music recommendation model designed in this study is significantly higher than that of traditional recommendation models.